diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2019-12-13 16:33:25 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2019-12-13 17:08:44 +0300 |
commit | 322555faa31de2e5bbfa062e9bf132a8d69b3ca6 (patch) | |
tree | dad06990efa65560828a2e0d92cb2191be18fb5a | |
parent | f5e00f735106b5ec635806a4c795a2bc46ae8369 (diff) |
USD: Remove file created in unit test after the test is done
No functional changes in the USD exporter, just some cleanup code added
to the unit test.
-rw-r--r-- | tests/gtests/usd/usd_stage_creation_test.cc | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/tests/gtests/usd/usd_stage_creation_test.cc b/tests/gtests/usd/usd_stage_creation_test.cc index fcf1e93ea7d..9d76b42371d 100644 --- a/tests/gtests/usd/usd_stage_creation_test.cc +++ b/tests/gtests/usd/usd_stage_creation_test.cc @@ -41,7 +41,7 @@ TEST_F(USDStageCreationTest, JSONFileLoadingTest) std::string filename = "usd-stage-creation-test.usdc"; if (FLAGS_test_blender_executable_dir.empty()) { - FAIL() << "Pass the flag"; + FAIL() << "Pass the --test-blender-executable-dir flag"; } /* Required on Linux to make BKE_appdir_folder_id() find the datafiles. @@ -64,9 +64,18 @@ TEST_F(USDStageCreationTest, JSONFileLoadingTest) usd_initialise_plugin_path(usd_datafiles_abspath); - /* Simply the ability to create a USD Stage for a specific filename means that the extension has - * been recognised by the USD library, and that a USD plugin has been loaded to write such files. - * Practically, this is a test to see whether the USD JSON files can be found and loaded. */ + /* Simply the ability to create a USD Stage for a specific filename means that the extension + * has been recognised by the USD library, and that a USD plugin has been loaded to write such + * files. Practically, this is a test to see whether the USD JSON files can be found and + * loaded. */ pxr::UsdStageRefPtr usd_stage = pxr::UsdStage::CreateNew(filename); - EXPECT_TRUE(usd_stage) << "unable to find suitable USD plugin to write " << filename; + if (usd_stage != nullptr) { + /* Even though we don't call usd_stage->SaveFile(), a file is still created on the filesystem + * when we call CreateNew(). It's immediately closed, though, so we can safely call unlink() + * here. */ + unlink(filename.c_str()); + } + else { + FAIL() << "unable to find suitable USD plugin to write " << filename; + } } |