Update datatest.cpp

This commit is contained in:
Jeffrey Walton 2021-03-19 22:40:28 -04:00
parent 9f251599b8
commit 143d711593
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
2 changed files with 15 additions and 22 deletions

View File

@ -18,9 +18,9 @@ then
fi
fi
DEBUG_CXXFLAGS="-DDEBUG -DCRYPTOPP_COVERAGE -g3 -O1 -coverage"
NOASM_CXXFLAGS="-DNDEBUG -DCRYPTOPP_DISABLE_ASM -DCRYPTOPP_COVERAGE -g3 -O1 -coverage"
RELEASE_CXXFLAGS="-DNDEBUG -DCRYPTOPP_COVERAGE -g3 -O1 -coverage"
DEBUG_CXXFLAGS="-DDEBUG -DCRYPTOPP_COVERAGE=1 -g3 -O1 -coverage"
NOASM_CXXFLAGS="-DNDEBUG -DCRYPTOPP_DISABLE_ASM -DCRYPTOPP_COVERAGE=1 -g3 -O1 -coverage"
RELEASE_CXXFLAGS="-DNDEBUG -DCRYPTOPP_COVERAGE=1 -g3 -O1 -coverage"
# Clean old artifacts
rm -rf TestCoverage/ >/dev/null
@ -83,9 +83,9 @@ echo "**************************************************"
lcov --add-tracefile cryptest_debug.info --add-tracefile cryptest_noasm.info --add-tracefile cryptest_release.info -o cryptest.info
lcov --remove cryptest.info "*/adhoc.*" -o cryptest.info
lcov --remove cryptest.info "*/fips140.*" -o cryptest.info
lcov --remove cryptest.info "*/*test.*" -o cryptest.info
lcov --remove cryptest.info "*adhoc*.*" -o cryptest.info
lcov --remove cryptest.info "*datatest*.*" -o cryptest.info
lcov --remove cryptest.info "*fips140*.*" -o cryptest.info
lcov --remove cryptest.info "/usr/*" -o cryptest.info
genhtml -o TestCoverage/ -t "Crypto++ test coverage" --num-spaces 4 cryptest.info

View File

@ -1132,10 +1132,8 @@ inline char LastChar(const std::string& str) {
return str[str.length()-1];
}
// GetField parses the name/value pairs. The tricky part is the insertion operator
// because Unix&Linux uses LF, OS X uses CR, and Windows uses CRLF. If this function
// is modified, then run 'cryptest.exe tv rsa_pkcs1_1_5' as a test. Its the parser
// file from hell. If it can be parsed without error, then things are likely OK.
// GetField parses the name/value pairs. If this function is modified,
// then run 'cryptest.exe tv all' to ensure parsing still works.
bool GetField(std::istream &is, std::string &name, std::string &value)
{
std::string line;
@ -1144,7 +1142,7 @@ bool GetField(std::istream &is, std::string &name, std::string &value)
// ***** Name *****
while (Readline(is, line))
{
// Eat whitespace and comments gracefully
// Eat empty lines and comments gracefully
if (line.empty() || line[0] == '#')
continue;
@ -1171,29 +1169,24 @@ bool GetField(std::istream &is, std::string &name, std::string &value)
do
{
// Trim leading and trailing whitespace, including OS X and Windows
// new lines. Don't parse comments here because there may be a line
// continuation at the end.
continueLine = false;
// Trim leading and trailing whitespace. Don't parse comments
// here because there may be a line continuation at the end.
line = TrimSpace(line);
continueLine = false;
if (line.empty())
continue;
// Early out for immediate line continuation
if (line[0] == '\\') {
continueLine = true;
continue;
}
// Check end of line. It must be last character
if (LastChar(line) == '\\') {
continueLine = true;
line.erase(line.end()-1);
line = TrimSpace(line);
}
// Re-trim after parsing
line = TrimComment(line);
line = TrimSpace(line);
if (line.empty())
continue;