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 14cceb6a0df30100849a9565e733fbec032902fd..cd2b196cf95ef4fb3a4a47947c0326cdca0df208 100644 (file)
@@ -31,8 +31,8 @@ rewrite_bad_config ()
        boost::system::error_code ec;
        boost::filesystem::remove ("build/test/config.xml", ec);
 
        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"
        f << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
          << "<Config>\n"
          << "<Foo></Foo>\n"
index 32d32f98879f8ddefcf16f7d19447085d5d873a6..8f8db37146d699234e4568801c8048f2f32a5453 100644 (file)
@@ -107,6 +107,9 @@ struct TestConfig
 {
        TestConfig ()
        {
 {
        TestConfig ()
        {
+               State::override_path = "build/test/state";
+               boost::filesystem::remove_all (*State::override_path);
+
                dcpomatic_setup ();
                setup_test_config ();
 
                dcpomatic_setup ();
                setup_test_config ();