]> git.proxmox.com Git - libgit2.git/commitdiff
test: Abort when the temp workdir cannot be created
authorVicent Marti <tanoku@gmail.com>
Wed, 6 Jul 2011 23:04:14 +0000 (01:04 +0200)
committerVicent Marti <tanoku@gmail.com>
Thu, 7 Jul 2011 00:54:07 +0000 (02:54 +0200)
tests/test_helpers.c

index d6c9242123ab325bf7fd74484d3553bc9724d53b..0900430e18175daef847051fecd1356d94d86a00 100644 (file)
@@ -217,9 +217,10 @@ int copydir_recurs(const char *source_directory_path, const char *destination_di
 
 int open_temp_repo(git_repository **repo, const char *path)
 {
-       int error;
-       if ((error = copydir_recurs(path, TEMP_REPO_FOLDER)) < GIT_SUCCESS)
-               return error;
+       if (copydir_recurs(path, TEMP_REPO_FOLDER) < GIT_SUCCESS) {
+               printf("\nFailed to create temporary folder. Aborting test suite.\n");
+               exit(-1);
+       }
 
        return git_repository_open(repo, TEMP_REPO_FOLDER);
 }
@@ -227,7 +228,10 @@ int open_temp_repo(git_repository **repo, const char *path)
 void close_temp_repo(git_repository *repo)
 {
        git_repository_free(repo);
-       git_futils_rmdir_r(TEMP_REPO_FOLDER, 1);
+       if (git_futils_rmdir_r(TEMP_REPO_FOLDER, 1) < GIT_SUCCESS) {
+               printf("\nFailed to remove temporary folder. Aborting test suite.\n");
+               exit(-1);
+       }
 }
 
 static int remove_placeholders_recurs(void *filename, char *path)