test_archive_builder: fix further trouble with selftest
vfs: initialize initstate (works without, but is more clear this way) This was SVN commit r4589.
This commit is contained in:
parent
abec0f17b9
commit
b2b5d4aa57
@ -88,20 +88,19 @@ public:
|
||||
path_init(); // required for file_make_unique_fn_copy
|
||||
(void)file_set_root_dir(0, ".");
|
||||
vfs_init();
|
||||
TS_ASSERT_OK(dir_create("archivetest", S_IRWXU|S_IRWXG|S_IRWXO));
|
||||
TS_ASSERT_OK(vfs_mount("", "archivetest"));
|
||||
}
|
||||
|
||||
void tearDown()
|
||||
{
|
||||
vfs_shutdown();
|
||||
dir_delete("archivetest");
|
||||
file_delete(archive_fn);
|
||||
path_reset_root_dir();
|
||||
}
|
||||
|
||||
void test_create_archive_with_random_files()
|
||||
{
|
||||
TS_ASSERT_OK(dir_create("archivetest", S_IRWXU|S_IRWXG|S_IRWXO));
|
||||
TS_ASSERT_OK(vfs_mount("", "archivetest"));
|
||||
|
||||
generate_random_files();
|
||||
TS_ASSERT_OK(archive_build(archive_fn, filenames));
|
||||
|
||||
@ -126,13 +125,15 @@ public:
|
||||
SAFE_ARRAY_DELETE(files[i].data);
|
||||
}
|
||||
TS_ASSERT_OK(archive_close(ha));
|
||||
|
||||
dir_delete("archivetest");
|
||||
file_delete(archive_fn);
|
||||
}
|
||||
|
||||
void test_multiple_init_shutdown()
|
||||
{
|
||||
vfs_init();
|
||||
// setUp has already vfs_init-ed it and tearDown will vfs_shutdown.
|
||||
vfs_shutdown();
|
||||
vfs_init();
|
||||
vfs_shutdown();
|
||||
}
|
||||
};
|
||||
|
@ -744,7 +744,7 @@ static enum VfsInitState
|
||||
VFS_INITIALIZED,
|
||||
VFS_SHUTDOWN
|
||||
}
|
||||
vfs_init_state;
|
||||
vfs_init_state = VFS_BEFORE_INIT;
|
||||
|
||||
// make the VFS tree ready for use. must be called before all other
|
||||
// functions below, barring explicit mentions to the contrary.
|
||||
|
@ -570,11 +570,13 @@ static LibError vfs_opt_init(const char* trace_filename, const char* archive_fn_
|
||||
// note: this is needed by should_rebuild_main_archive and later in
|
||||
// vfs_opt_continue; must be done here instead of inside the former
|
||||
// because that is not called when force_build == true.
|
||||
{
|
||||
char dir[PATH_MAX];
|
||||
path_dir_only(archive_fn_fmt, dir);
|
||||
RETURN_ERR(file_get_sorted_dirents(dir, existing_archives));
|
||||
DirEntIt new_end = std::remove_if(existing_archives.begin(), existing_archives.end(), IsArchive(archive_fn));
|
||||
existing_archives.erase(new_end, existing_archives.end());
|
||||
}
|
||||
|
||||
// bail if we shouldn't rebuild the archive.
|
||||
if(!force_build && !should_rebuild_main_archive(trace_filename, existing_archives))
|
||||
@ -595,7 +597,7 @@ static LibError vfs_opt_init(const char* trace_filename, const char* archive_fn_
|
||||
ConnectionBuilder cbuilder;
|
||||
RETURN_ERR(cbuilder.run(trace_filename, connections));
|
||||
|
||||
// create output filelist by first adding the above edges (most
|
||||
// create output filename list by first adding the above edges (most
|
||||
// frequent first) and then adding the rest sequentially.
|
||||
TourBuilder builder(file_nodes, connections, fn_vector);
|
||||
fn_vector.push_back(0); // 0-terminate for use as Filenames
|
||||
|
Loading…
Reference in New Issue
Block a user