summaryrefslogtreecommitdiff
path: root/test/correctness
diff options
context:
space:
mode:
authorCedric Nugteren <web@cedricnugteren.nl>2016-11-27 11:00:29 +0100
committerCedric Nugteren <web@cedricnugteren.nl>2016-11-27 11:00:29 +0100
commit39c49bf4f977427de42fdfe27e8a2ed41ae4923e (patch)
treec07f81151ec42d7fc7bf9a4944f1de2db78c588d /test/correctness
parent8cfcda52a8c7a9e3f570b0c7ee43b007968ab6ab (diff)
Made it possible to use the command-line environmental variables for each executable and without re-running CMake
Diffstat (limited to 'test/correctness')
-rw-r--r--test/correctness/testblas.cpp4
-rw-r--r--test/correctness/testblas.hpp5
-rw-r--r--test/correctness/tester.cpp18
-rw-r--r--test/correctness/tester.hpp2
4 files changed, 15 insertions, 14 deletions
diff --git a/test/correctness/testblas.cpp b/test/correctness/testblas.cpp
index ce3b0e07..5fddb37b 100644
--- a/test/correctness/testblas.cpp
+++ b/test/correctness/testblas.cpp
@@ -49,13 +49,13 @@ template <> const std::vector<Transpose> TestBlas<double2,double>::kTransposes =
// Constructor, initializes the base class tester and input data
template <typename T, typename U>
-TestBlas<T,U>::TestBlas(int argc, char *argv[], const bool silent,
+TestBlas<T,U>::TestBlas(const std::vector<std::string> &arguments, const bool silent,
const std::string &name, const std::vector<std::string> &options,
const Routine run_routine,
const Routine run_reference1, const Routine run_reference2,
const ResultGet get_result, const ResultIndex get_index,
const ResultIterator get_id1, const ResultIterator get_id2):
- Tester<T,U>(argc, argv, silent, name, options),
+ Tester<T,U>(arguments, silent, name, options),
kOffsets(GetOffsets()),
kAlphaValues(GetExampleScalars<U>(full_test_)),
kBetaValues(GetExampleScalars<U>(full_test_)),
diff --git a/test/correctness/testblas.hpp b/test/correctness/testblas.hpp
index da572e01..27fd84c3 100644
--- a/test/correctness/testblas.hpp
+++ b/test/correctness/testblas.hpp
@@ -80,7 +80,7 @@ class TestBlas: public Tester<T,U> {
using ResultIterator = std::function<size_t(const Arguments<U>&)>;
// Constructor, initializes the base class tester and input data
- TestBlas(int argc, char *argv[], const bool silent,
+ TestBlas(const std::vector<std::string> &arguments, const bool silent,
const std::string &name, const std::vector<std::string> &options,
const Routine run_routine,
const Routine run_reference1, const Routine run_reference2,
@@ -117,6 +117,7 @@ class TestBlas: public Tester<T,U> {
// is automatically compiled for each routine, templated by the parameter "C".
template <typename C, typename T, typename U>
size_t RunTests(int argc, char *argv[], const bool silent, const std::string &name) {
+ auto command_line_args = RetrieveCommandLineArguments(argc, argv);
// Sets the reference to test against
#if defined(CLBLAST_REF_CLBLAS) && defined(CLBLAST_REF_CBLAS)
@@ -139,7 +140,7 @@ size_t RunTests(int argc, char *argv[], const bool silent, const std::string &na
// Creates a tester
auto options = C::GetOptions();
- TestBlas<T,U> tester{argc, argv, silent, name, options,
+ TestBlas<T,U> tester{command_line_args, silent, name, options,
C::RunRoutine, reference_routine1, reference_routine2,
C::DownloadResult, C::GetResultIndex, C::ResultID1, C::ResultID2};
diff --git a/test/correctness/tester.cpp b/test/correctness/tester.cpp
index 481640fc..c449b09d 100644
--- a/test/correctness/tester.cpp
+++ b/test/correctness/tester.cpp
@@ -67,15 +67,15 @@ template <typename T, typename U> const std::string Tester<T,U>::kUnsupportedRef
// General constructor for all CLBlast testers. It prints out the test header to stdout and sets-up
// the clBLAS library for reference.
template <typename T, typename U>
-Tester<T,U>::Tester(int argc, char *argv[], const bool silent,
+Tester<T,U>::Tester(const std::vector<std::string> &arguments, const bool silent,
const std::string &name, const std::vector<std::string> &options):
help_("Options given/available:\n"),
- platform_(Platform(GetArgument(argc, argv, help_, kArgPlatform, ConvertArgument(std::getenv("CLBLAST_PLATFORM"), size_t{0})))),
- device_(Device(platform_, GetArgument(argc, argv, help_, kArgDevice, ConvertArgument(std::getenv("CLBLAST_DEVICE"), size_t{0})))),
+ platform_(Platform(GetArgument(arguments, help_, kArgPlatform, ConvertArgument(std::getenv("CLBLAST_PLATFORM"), size_t{0})))),
+ device_(Device(platform_, GetArgument(arguments, help_, kArgDevice, ConvertArgument(std::getenv("CLBLAST_DEVICE"), size_t{0})))),
context_(Context(device_)),
queue_(Queue(context_, device_)),
- full_test_(CheckArgument(argc, argv, help_, kArgFullTest)),
- verbose_(CheckArgument(argc, argv, help_, kArgVerbose)),
+ full_test_(CheckArgument(arguments, help_, kArgFullTest)),
+ verbose_(CheckArgument(arguments, help_, kArgVerbose)),
error_log_{},
num_passed_{0},
num_skipped_{0},
@@ -88,14 +88,14 @@ Tester<T,U>::Tester(int argc, char *argv[], const bool silent,
// Determines which reference to test against
#if defined(CLBLAST_REF_CLBLAS) && defined(CLBLAST_REF_CBLAS)
- compare_clblas_ = GetArgument(argc, argv, help_, kArgCompareclblas, 0);
- compare_cblas_ = GetArgument(argc, argv, help_, kArgComparecblas, 1);
+ compare_clblas_ = GetArgument(arguments, help_, kArgCompareclblas, 0);
+ compare_cblas_ = GetArgument(arguments, help_, kArgComparecblas, 1);
#elif CLBLAST_REF_CLBLAS
- compare_clblas_ = GetArgument(argc, argv, help_, kArgCompareclblas, 1);
+ compare_clblas_ = GetArgument(arguments, help_, kArgCompareclblas, 1);
compare_cblas_ = 0;
#elif CLBLAST_REF_CBLAS
compare_clblas_ = 0;
- compare_cblas_ = GetArgument(argc, argv, help_, kArgComparecblas, 1);
+ compare_cblas_ = GetArgument(arguments, help_, kArgComparecblas, 1);
#else
compare_clblas_ = 0;
compare_cblas_ = 0;
diff --git a/test/correctness/tester.hpp b/test/correctness/tester.hpp
index c7fb4407..d8462cef 100644
--- a/test/correctness/tester.hpp
+++ b/test/correctness/tester.hpp
@@ -70,7 +70,7 @@ class Tester {
// Creates an instance of the tester, running on a particular OpenCL platform and device. It
// takes the routine's names as an additional parameter.
- explicit Tester(int argc, char *argv[], const bool silent,
+ explicit Tester(const std::vector<std::string> &arguments, const bool silent,
const std::string &name, const std::vector<std::string> &options);
~Tester();