From: Chris Koeritz Date: Wed, 14 Sep 2016 23:39:56 +0000 (-0400) Subject: added removal of temporary dir used in test dir tree, but it exposed a long-standing... X-Git-Tag: 2.140.90~455 X-Git-Url: https://feistymeow.org/gitweb/?p=feisty_meow.git;a=commitdiff_plain;h=17a418bc7bf82e5665790799fc93d34e385f4fe2 added removal of temporary dir used in test dir tree, but it exposed a long-standing weakness in that we have no recursive delete method. this is not rocket science, plus it's needed by places in the code, so it should be implemented. --- diff --git a/nucleus/library/tests_filesystem/makefile b/nucleus/library/tests_filesystem/makefile index b517463e..7761b8c6 100644 --- a/nucleus/library/tests_filesystem/makefile +++ b/nucleus/library/tests_filesystem/makefile @@ -5,8 +5,8 @@ TYPE = test TARGETS = test_byte_filer.exe test_directory.exe test_directory_tree.exe test_file_info.exe \ test_file_time.exe test_filename.exe test_huge_file.exe DEFINITIONS += USE_HOOPLE_DLLS -LOCAL_LIBS_USED = unit_test application configuration filesystem loggers mathematics nodes \ - structures textual timely structures basis +LOCAL_LIBS_USED = unit_test application configuration filesystem loggers \ + mathematics nodes processes structures textual timely structures basis RUN_TARGETS = $(ACTUAL_TARGETS) include cpp/rules.def diff --git a/nucleus/library/tests_filesystem/test_directory_tree.cpp b/nucleus/library/tests_filesystem/test_directory_tree.cpp index d413f67d..f9fa5adf 100644 --- a/nucleus/library/tests_filesystem/test_directory_tree.cpp +++ b/nucleus/library/tests_filesystem/test_directory_tree.cpp @@ -12,16 +12,17 @@ * Please send any updates to: fred@gruntose.com * */ +#include #include #include -#include -#include -#include -#include #include #include #include +#include +#include +#include #include +#include #include #include @@ -30,6 +31,7 @@ using namespace basis; using namespace mathematics; using namespace filesystem; using namespace loggers; +using namespace processes; using namespace structures; using namespace textual; using namespace timely; @@ -206,6 +208,17 @@ LOG("what happened with that? did it work?"); //hmmm: compare the directories with what we expect to be made; // do a dirtree iterator on the path, and make sure each of those exists in the target place. + + // clean up the output directory. +//this won't do it; it's a directory! +// bool worked = tmpdir.recursive_unlink(); +// ASSERT_TRUE(worked, "removing temporary files after test"); + +//hmmm: plug in real recursive delete here instead. +basis::un_int kid; +launch_process::run("rm", astring("-rf ") + tmpdir.raw(), launch_process::AWAIT_APP_EXIT, kid); +ASSERT_FALSE(kid, "removing temporary files after test"); + }