added removal of temporary dir used in test dir tree, but it exposed a long-standing...
authorChris Koeritz <fred@gruntose.com>
Wed, 14 Sep 2016 23:39:56 +0000 (19:39 -0400)
committerChris Koeritz <fred@gruntose.com>
Wed, 14 Sep 2016 23:39:56 +0000 (19:39 -0400)
this is not rocket science, plus it's needed by places in the code, so it should be implemented.

nucleus/library/tests_filesystem/makefile
nucleus/library/tests_filesystem/test_directory_tree.cpp

index b517463e9667a443e4e8b158a73a96a143f629dc..7761b8c65dc5e0577f7b52f2514b46f864ee021d 100644 (file)
@@ -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
index d413f67df9d01c1ce2dbbf8f3e201d2b6119f109..f9fa5adf8bc3670b45dadb1ec4bf987388a9ca3d 100644 (file)
 * Please send any updates to: fred@gruntose.com                               *
 */
 
+#include <application/hoople_main.h>
 #include <basis/functions.h>
 #include <basis/guards.h>
-#include <structures/string_array.h>
-#include <application/hoople_main.h>
-#include <loggers/critical_events.h>
-#include <loggers/program_wide_logger.h>
 #include <filesystem/directory_tree.h>
 #include <filesystem/filename.h>
 #include <filesystem/filename_list.h>
+#include <loggers/critical_events.h>
+#include <loggers/program_wide_logger.h>
+#include <processes/launch_process.h>
 #include <structures/static_memory_gremlin.h>
+#include <structures/string_array.h>
 #include <textual/string_manipulation.h>
 #include <unit_test/unit_base.h>
 
@@ -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");
+
   }