From be7d140b03690294a751d600cc0dd738415e7e03 Mon Sep 17 00:00:00 2001 From: Niklas Angare Date: Sat, 21 Mar 2015 02:55:44 +0100 Subject: [PATCH] Take input filename on the command line to test/image. This enables test runners to copy the file to the target. It also makes the code that looks for the file in a different path unnecessary since Boost.Build will pass the proper relative path. --- test/Jamfile.v2 | 2 +- test/image.cpp | 22 +++++++++------------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 40bd90f5..5b48b4d6 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -15,7 +15,7 @@ test-suite gil : sample_image.cpp error_if.cpp : - : + : gil_reference_checksums.txt : $(BOOST_ROOT) BOOST_GIL_NO_IO _SCL_SECURE_NO_WARNINGS ] [ run channel.cpp error_if.cpp diff --git a/test/image.cpp b/test/image.cpp index 27953442..e05831a7 100644 --- a/test/image.cpp +++ b/test/image.cpp @@ -568,21 +568,17 @@ void test_image(const char* ref_checksum) { } int main(int argc, char* argv[]) { - - const char* local_name = "gil_reference_checksums.txt"; - const char* name_from_status = "../libs/gil/test/gil_reference_checksums.txt"; - - std::ifstream file_is_there(local_name); + if(argc != 2) + { + std::cerr << "Checksum file name argument missing" << std::endl; + return 1; + } + std::ifstream file_is_there(argv[1]); if (file_is_there) { - test_image(local_name); + test_image(argv[1]); } else { - std::ifstream file_is_there(name_from_status); - if (file_is_there) - test_image(name_from_status); - else { - std::cerr << "Unable to open gil_reference_checksums.txt"<