aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/tests/tests.cpp17
-rw-r--r--src/tests/tests.h2
2 files changed, 10 insertions, 9 deletions
diff --git a/src/tests/tests.cpp b/src/tests/tests.cpp
index 3137c5ba7..55c9e3824 100644
--- a/src/tests/tests.cpp
+++ b/src/tests/tests.cpp
@@ -484,10 +484,10 @@ std::string Test::random_password()
return Botan::hex_encode(Test::rng().random_vec(len));
}
-Text_Based_Test::Text_Based_Test(const std::string& data_dir,
+Text_Based_Test::Text_Based_Test(const std::string& data_src,
const std::vector<std::string>& required_keys,
const std::vector<std::string>& optional_keys) :
- m_data_dir(data_dir)
+ m_data_src(data_src)
{
if(required_keys.empty())
throw std::runtime_error("Invalid test spec");
@@ -498,11 +498,11 @@ Text_Based_Test::Text_Based_Test(const std::string& data_dir,
}
Text_Based_Test::Text_Based_Test(const std::string& algo,
- const std::string& data_dir,
+ const std::string& data_src,
const std::vector<std::string>& required_keys,
const std::vector<std::string>& optional_keys) :
m_algo(algo),
- m_data_dir(data_dir)
+ m_data_src(data_src)
{
if(required_keys.empty())
throw std::runtime_error("Invalid test spec");
@@ -611,15 +611,16 @@ std::string Text_Based_Test::get_next_line()
{
if(m_first)
{
- std::vector<std::string> fs = Botan::get_files_recursive(m_data_dir);
-
- if(fs.empty() && m_data_dir.find(".vec") != std::string::npos)
+ if(m_data_src.find(".vec") != std::string::npos)
{
- m_srcs.push_back(m_data_dir);
+ m_srcs.push_back(m_data_src);
}
else
{
+ const auto fs = Botan::get_files_recursive(m_data_src);
m_srcs.assign(fs.begin(), fs.end());
+ if(m_srcs.empty())
+ throw std::runtime_error("Error reading test data dir " + m_data_src);
}
m_first = false;
diff --git a/src/tests/tests.h b/src/tests/tests.h
index 09d89459d..273035cbf 100644
--- a/src/tests/tests.h
+++ b/src/tests/tests.h
@@ -337,7 +337,7 @@ class Text_Based_Test : public Test
std::string algo_name() const { return m_algo; }
private:
std::string m_algo;
- std::string m_data_dir;
+ std::string m_data_src;
std::set<std::string> m_required_keys;
std::set<std::string> m_optional_keys;
std::string m_output_key;