diff options
author | Jeffrey Walton <noloader@gmail.com> | 2021-03-19 22:40:28 -0400 |
---|---|---|
committer | Jeffrey Walton <noloader@gmail.com> | 2021-03-19 22:40:28 -0400 |
commit | 143d71159335c0ab7b344a4571cf002587a99842 (patch) | |
tree | 946bebd6d9e3111cda652e69275c1fe19d71b8c2 | |
parent | 9f251599b887d04ae626036c794ddd197745744a (diff) | |
download | cryptopp-git-143d71159335c0ab7b344a4571cf002587a99842.tar.gz |
Update datatest.cpp
-rwxr-xr-x | TestScripts/cryptest-coverage.sh | 12 | ||||
-rw-r--r-- | datatest.cpp | 25 |
2 files changed, 15 insertions, 22 deletions
diff --git a/TestScripts/cryptest-coverage.sh b/TestScripts/cryptest-coverage.sh index 92bc3fcf..1655afaa 100755 --- a/TestScripts/cryptest-coverage.sh +++ b/TestScripts/cryptest-coverage.sh @@ -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 diff --git a/datatest.cpp b/datatest.cpp index f6543a32..fafa01e0 100644 --- a/datatest.cpp +++ b/datatest.cpp @@ -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;
@@ -1153,7 +1151,7 @@ bool GetField(std::istream &is, std::string &name, std::string &value) SignalTestError("Unable to parse name/value pair");
name = TrimSpace(line.substr(0, pos));
- line = TrimSpace(line.substr(pos + 1));
+ line = TrimSpace(line.substr(pos +1));
// Empty name is bad
if (name.empty())
@@ -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;
|