diff options
author | Ondrej Holy <oholy@redhat.com> | 2021-01-13 09:52:01 +0100 |
---|---|---|
committer | Ondrej Holy <oholy@redhat.com> | 2021-01-13 12:04:43 +0100 |
commit | c97255cb31e0dd0e0fad07e3c0fe579eb8d61262 (patch) | |
tree | 9387d60a5b23a15cfb64f473d266a89e2c82f0bb /test/automated/displayless/test-file-operations-copy-files.c | |
parent | ac9be83e0117c42328698cacf1372c87b437ae71 (diff) | |
download | nautilus-wip/oholy/test-unique-dir.tar.gz |
test: Run tests in unique directorywip/oholy/test-unique-dir
The tests currently create various files and directories with generic names
and manipulate with them directly in the `/tmp` directory. The tests also
remove all files in `/tmp` with the generic prefixes like `move`, `copy`,
etc. This can simply cause test suite failures if files with such names
already exist in the `/tmp` directory. Also, the test suite can easily remove
files created by other applications. Let's always create an unique directory
in `/tmp` for tests to fix the mentioned problems...
Diffstat (limited to 'test/automated/displayless/test-file-operations-copy-files.c')
-rw-r--r-- | test/automated/displayless/test-file-operations-copy-files.c | 59 |
1 files changed, 32 insertions, 27 deletions
diff --git a/test/automated/displayless/test-file-operations-copy-files.c b/test/automated/displayless/test-file-operations-copy-files.c index 1a7d80201..605094efd 100644 --- a/test/automated/displayless/test-file-operations-copy-files.c +++ b/test/automated/displayless/test-file-operations-copy-files.c @@ -12,7 +12,7 @@ test_copy_one_file (void) create_one_file ("copy"); - root = g_file_new_for_path (g_get_tmp_dir ()); + root = g_file_new_for_path (nautilus_get_tmp_dir ()); g_assert_true (root != NULL); first_dir = g_file_get_child (root, "copy_first_dir"); @@ -47,7 +47,7 @@ test_copy_one_file_undo (void) create_one_file ("copy"); - root = g_file_new_for_path (g_get_tmp_dir ()); + root = g_file_new_for_path (nautilus_get_tmp_dir ()); g_assert_true (root != NULL); first_dir = g_file_get_child (root, "copy_first_dir"); @@ -84,7 +84,7 @@ test_copy_one_empty_directory (void) create_one_empty_directory ("copy"); - root = g_file_new_for_path (g_get_tmp_dir ()); + root = g_file_new_for_path (nautilus_get_tmp_dir ()); g_assert_true (root != NULL); first_dir = g_file_get_child (root, "copy_first_dir"); g_assert_true (first_dir != NULL); @@ -118,7 +118,7 @@ test_copy_one_empty_directory_undo (void) create_one_empty_directory ("copy"); - root = g_file_new_for_path (g_get_tmp_dir ()); + root = g_file_new_for_path (nautilus_get_tmp_dir ()); g_assert_true (root != NULL); first_dir = g_file_get_child (root, "copy_first_dir"); g_assert_true (first_dir != NULL); @@ -154,7 +154,7 @@ test_copy_files_small (void) create_multiple_files ("copy", 10); - root = g_file_new_for_path (g_get_tmp_dir ()); + root = g_file_new_for_path (nautilus_get_tmp_dir ()); g_assert_true (root != NULL); for (int i = 0; i < 10; i++) @@ -198,7 +198,7 @@ test_copy_files_small_undo (void) create_multiple_files ("copy", 10); - root = g_file_new_for_path (g_get_tmp_dir ()); + root = g_file_new_for_path (nautilus_get_tmp_dir ()); g_assert_true (root != NULL); for (int i = 0; i < 10; i++) @@ -244,7 +244,7 @@ test_copy_files_medium (void) create_multiple_files ("copy", 1000); - root = g_file_new_for_path (g_get_tmp_dir ()); + root = g_file_new_for_path (nautilus_get_tmp_dir ()); g_assert_true (root != NULL); for (int i = 0; i < 1000; i++) @@ -288,7 +288,7 @@ test_copy_files_medium_undo (void) create_multiple_files ("copy", 1000); - root = g_file_new_for_path (g_get_tmp_dir ()); + root = g_file_new_for_path (nautilus_get_tmp_dir ()); g_assert_true (root != NULL); for (int i = 0; i < 1000; i++) @@ -333,7 +333,7 @@ test_copy_files_large (void) create_multiple_files ("copy", 10000); - root = g_file_new_for_path (g_get_tmp_dir ()); + root = g_file_new_for_path (nautilus_get_tmp_dir ()); g_assert_true (root != NULL); for (int i = 0; i < 10000; i++) @@ -375,7 +375,7 @@ test_copy_files_large_undo (void) create_multiple_files ("copy", 10000); - root = g_file_new_for_path (g_get_tmp_dir ()); + root = g_file_new_for_path (nautilus_get_tmp_dir ()); g_assert_true (root != NULL); for (int i = 0; i < 10000; i++) @@ -421,7 +421,7 @@ test_copy_directories_small (void) create_multiple_directories ("copy", 10); - root = g_file_new_for_path (g_get_tmp_dir ()); + root = g_file_new_for_path (nautilus_get_tmp_dir ()); g_assert_true (root != NULL); for (int i = 0; i < 10; i++) @@ -465,7 +465,7 @@ test_copy_directories_small_undo (void) create_multiple_directories ("copy", 10); - root = g_file_new_for_path (g_get_tmp_dir ()); + root = g_file_new_for_path (nautilus_get_tmp_dir ()); g_assert_true (root != NULL); for (int i = 0; i < 10; i++) @@ -511,7 +511,7 @@ test_copy_directories_medium (void) create_multiple_directories ("copy", 1000); - root = g_file_new_for_path (g_get_tmp_dir ()); + root = g_file_new_for_path (nautilus_get_tmp_dir ()); g_assert_true (root != NULL); for (int i = 0; i < 1000; i++) @@ -555,7 +555,7 @@ test_copy_directories_medium_undo (void) create_multiple_directories ("copy", 1000); - root = g_file_new_for_path (g_get_tmp_dir ()); + root = g_file_new_for_path (nautilus_get_tmp_dir ()); g_assert_true (root != NULL); for (int i = 0; i < 1000; i++) @@ -601,7 +601,7 @@ test_copy_directories_large (void) create_multiple_directories ("copy", 10000); - root = g_file_new_for_path (g_get_tmp_dir ()); + root = g_file_new_for_path (nautilus_get_tmp_dir ()); g_assert_true (root != NULL); for (int i = 0; i < 10000; i++) @@ -645,7 +645,7 @@ test_copy_directories_large_undo (void) create_multiple_directories ("copy", 10000); - root = g_file_new_for_path (g_get_tmp_dir ()); + root = g_file_new_for_path (nautilus_get_tmp_dir ()); g_assert_true (root != NULL); for (int i = 0; i < 10000; i++) @@ -695,7 +695,7 @@ test_copy_full_directory (void) create_one_file ("copy"); - root = g_file_new_for_path (g_get_tmp_dir ()); + root = g_file_new_for_path (nautilus_get_tmp_dir ()); g_assert_true (root != NULL); first_dir = g_file_get_child (root, "copy_first_dir"); @@ -735,7 +735,7 @@ test_copy_full_directory_undo (void) create_one_file ("copy"); - root = g_file_new_for_path (g_get_tmp_dir ()); + root = g_file_new_for_path (nautilus_get_tmp_dir ()); g_assert_true (root != NULL); first_dir = g_file_get_child (root, "copy_first_dir"); @@ -783,7 +783,7 @@ test_copy_first_hierarchy (void) create_first_hierarchy ("copy"); - root = g_file_new_for_path (g_get_tmp_dir ()); + root = g_file_new_for_path (nautilus_get_tmp_dir ()); g_assert_true (root != NULL); first_dir = g_file_get_child (root, "copy_first_dir"); @@ -832,7 +832,7 @@ test_copy_first_hierarchy_undo (void) create_first_hierarchy ("copy"); - root = g_file_new_for_path (g_get_tmp_dir ()); + root = g_file_new_for_path (nautilus_get_tmp_dir ()); g_assert_true (root != NULL); first_dir = g_file_get_child (root, "copy_first_dir"); @@ -888,7 +888,7 @@ test_copy_second_hierarchy (void) create_second_hierarchy ("copy"); - root = g_file_new_for_path (g_get_tmp_dir ()); + root = g_file_new_for_path (nautilus_get_tmp_dir ()); first_dir = g_file_get_child (root, "copy_first_dir"); files = g_list_prepend (files, g_object_ref (first_dir)); g_assert_true (first_dir != NULL); @@ -935,7 +935,7 @@ test_copy_second_hierarchy_undo (void) create_second_hierarchy ("copy"); - root = g_file_new_for_path (g_get_tmp_dir ()); + root = g_file_new_for_path (nautilus_get_tmp_dir ()); g_assert_true (root != NULL); first_dir = g_file_get_child (root, "copy_first_dir"); @@ -992,7 +992,7 @@ test_copy_third_hierarchy (void) create_third_hierarchy ("copy"); - root = g_file_new_for_path (g_get_tmp_dir ()); + root = g_file_new_for_path (nautilus_get_tmp_dir ()); g_assert_true (root != NULL); first_dir = g_file_get_child (root, "copy_first_dir"); @@ -1062,7 +1062,7 @@ test_copy_third_hierarchy_undo (void) create_third_hierarchy ("copy"); - root = g_file_new_for_path (g_get_tmp_dir ()); + root = g_file_new_for_path (nautilus_get_tmp_dir ()); g_assert_true (root != NULL); first_dir = g_file_get_child (root, "copy_first_dir"); @@ -1139,7 +1139,7 @@ test_copy_fourth_hierarchy (void) create_fourth_hierarchy ("copy"); - root = g_file_new_for_path (g_get_tmp_dir ()); + root = g_file_new_for_path (nautilus_get_tmp_dir ()); g_assert_true (root != NULL); first_dir = g_file_get_child (root, "copy_first_dir"); @@ -1196,7 +1196,7 @@ test_copy_fourth_hierarchy_undo (void) create_fourth_hierarchy ("copy"); - root = g_file_new_for_path (g_get_tmp_dir ()); + root = g_file_new_for_path (nautilus_get_tmp_dir ()); g_assert_true (root != NULL); first_dir = g_file_get_child (root, "copy_first_dir"); @@ -1304,6 +1304,7 @@ main (int argc, char *argv[]) { g_autoptr (NautilusFileUndoManager) undo_manager = NULL; + int ret; undo_manager = nautilus_file_undo_manager_new (); g_test_init (&argc, &argv, NULL); @@ -1312,5 +1313,9 @@ main (int argc, setup_test_suite (); - return g_test_run (); + ret = g_test_run (); + + nautilus_clear_tmp_dir (); + + return ret; } |