From: Carl Hetherington Date: Tue, 10 Oct 2023 08:41:57 +0000 (+0200) Subject: Fix argument parsing on Ubuntu 16.04. X-Git-Tag: v1.8.84 X-Git-Url: https://main.carlh.net/gitweb/?a=commitdiff_plain;h=67ce6dc8ab32efe94141a3516942f0487586b778;p=libdcp.git Fix argument parsing on Ubuntu 16.04. --- diff --git a/test/test.cc b/test/test.cc index fb8d8a3d..bff647d7 100644 --- a/test/test.cc +++ b/test/test.cc @@ -91,8 +91,18 @@ struct TestConfig TestConfig() { dcp::init (); - if (boost::unit_test::framework::master_test_suite().argc >= 2) { - private_test = boost::unit_test::framework::master_test_suite().argv[1]; + auto const argc = boost::unit_test::framework::master_test_suite().argc; + auto const argv = boost::unit_test::framework::master_test_suite().argv; + if (argc >= 3 && strcmp(argv[1], "--") == 0) { + /* For some reason on Ubuntu 16.04 the -- we pass in ends up in argv[1] so we + * need to get the private_test from argv[2]... + */ + private_test = argv[2]; + } else if (argc >= 2) { + /* ... but everywhere else it's removed, so we can just get the private_test + * value from argv[1]. + */ + private_test = argv[1]; } using namespace boost::filesystem;