X-Git-Url: https://feistymeow.org/gitweb/?a=blobdiff_plain;f=nucleus%2Flibrary%2Ftests_filesystem%2Ftest_byte_filer.cpp;h=283ebb0529b63198ce9fd32d6b46bd437c3a31d2;hb=f76584286a930d6c47e7229a63ba828b8d28af18;hp=fca6b739ba5e94256a060755af2b04a3a933b88e;hpb=7314eb5ed9b8141e34b269707e5ec2994e41d813;p=feisty_meow.git diff --git a/nucleus/library/tests_filesystem/test_byte_filer.cpp b/nucleus/library/tests_filesystem/test_byte_filer.cpp index fca6b739..283ebb05 100644 --- a/nucleus/library/tests_filesystem/test_byte_filer.cpp +++ b/nucleus/library/tests_filesystem/test_byte_filer.cpp @@ -44,7 +44,7 @@ using namespace unit_test; #define LOG(s) CLASS_EMERGENCY_LOG(program_wide_logger::get(), s) -#define DEBUG_BYTE_FILER +//#define DEBUG_BYTE_FILER // uncomment for noisy test run. class test_byte_filer : virtual public unit_base, virtual public application_shell @@ -63,8 +63,10 @@ const astring &TEST_FILE() const char *TEST_FILE_SUFFIX = ".txt"; static astring __hidden_filename; if (!__hidden_filename) { - __hidden_filename = environment::get("TMP"); + __hidden_filename = environment::TMP(); if (!__hidden_filename) __hidden_filename = "/tmp"; + // try to create it just in case it wasn't there already. + directory::make_directory(__hidden_filename); __hidden_filename += TEST_FILE_BASE; __hidden_filename += a_sprintf("%d", chaos().inclusive(0, 65535)); __hidden_filename += TEST_FILE_SUFFIX; @@ -128,11 +130,8 @@ int test_byte_filer::run_simple_test() int should_be_failure = fred.write(to_fake_stuff); ASSERT_EQUAL(should_be_failure, 0, "write on read only, should not succeed"); -/// int fredsize = int(fred.size()); -/// fred.chunk_factor(fredsize); - #ifdef DEBUG_BYTE_FILER - LOG(a_sprintf("about to try reading from file %d bytes", fredsize)); + LOG(a_sprintf("about to try reading from file %d bytes", block_size * 2)); #endif byte_array file_contents; int bytes_read = fred.read(file_contents, block_size * 2); @@ -175,9 +174,8 @@ int test_byte_filer::run_file_scan() files.zap(0, 0); // toss the first element since that's our app filename. if (!files.length()) { - // pretend they gave us the list of files in the TMP directory. some of + // pretend they gave us the list of files in the current directory. some of // these might fail if they're locked up. -// astring tmpdir = environment::get("TMP"); astring tmpdir = application_configuration::current_directory(); directory dir(tmpdir); for (int i = 0; i < dir.files().length(); i++) { @@ -228,7 +226,7 @@ int test_byte_filer::run_file_scan() int test_byte_filer::execute() { -// FUNCDEF("execute"); + FUNCDEF("execute"); int ret = run_simple_test(); if (ret) return ret; // failed. ret = run_file_scan();