Skip to content

Commit

Permalink
Handle CMake build path
Browse files Browse the repository at this point in the history
  • Loading branch information
ckormanyos committed Oct 19, 2024
1 parent d9f4ba4 commit 2a46bc0
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions test/test_cavs_nist_sha1_short.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ auto where_file(const std::string& test_vectors_filename) -> std::string
}
else
{
// Try to open the file from the absolute path.
test_vectors_filename_relative = test_vectors_filename;
// CMake builds
test_vectors_filename_relative = "../../../../libs/crypt/test/nist_cavs/vectors/shabytesvectors/" + test_vectors_filename;

std::ifstream in_04(test_vectors_filename_relative.c_str());

Expand All @@ -130,7 +130,21 @@ auto where_file(const std::string& test_vectors_filename) -> std::string
}
else
{
test_vectors_filename_relative = "";
// Try to open the file from the absolute path.
test_vectors_filename_relative = test_vectors_filename;

std::ifstream in_05(test_vectors_filename_relative.c_str());

const bool file_05_is_open { in_05.is_open() };

if(file_05_is_open)
{
in_05.close();
}
else
{
test_vectors_filename_relative = "";
}
}
}
}
Expand Down

0 comments on commit 2a46bc0

Please sign in to comment.