Make unit tests use their own configuration rather than whatever
authorCarl Hetherington <cth@carlh.net>
Tue, 29 Sep 2020 21:17:53 +0000 (23:17 +0200)
committerCarl Hetherington <cth@carlh.net>
Tue, 29 Sep 2020 21:17:53 +0000 (23:17 +0200)
happens to be in $HOME.

This is especially important for signer certificates; without this
it looks like the ones from $HOME will be used.

test/config_test.cc
test/test.cc

index 14cceb6..cd2b196 100644 (file)
@@ -31,8 +31,8 @@ rewrite_bad_config ()
        boost::system::error_code ec;
        boost::filesystem::remove ("build/test/config.xml", ec);
 
-       Config::override_path = "build/test";
-       ofstream f ("build/test/config.xml");
+       Config::override_path = "build/test/bad_config";
+       ofstream f ("build/test/bad_config/config.xml");
        f << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
          << "<Config>\n"
          << "<Foo></Foo>\n"
index 32d32f9..8f8db37 100644 (file)
@@ -107,6 +107,9 @@ struct TestConfig
 {
        TestConfig ()
        {
+               State::override_path = "build/test/state";
+               boost::filesystem::remove_all (*State::override_path);
+
                dcpomatic_setup ();
                setup_test_config ();