diff options
author | Jeffrey Walton <noloader@gmail.com> | 2017-05-29 00:43:20 -0400 |
---|---|---|
committer | Jeffrey Walton <noloader@gmail.com> | 2017-05-29 00:43:20 -0400 |
commit | ae3922dda0c4c7d75381f2b74425c34adb762c5f (patch) | |
tree | e8a2fbe1a245fe38f710b77aa76064c27ee7df4c | |
parent | 0df38c3506efbe8aac5ce7a695c01d487348dcc1 (diff) | |
download | cryptopp-git-ae3922dda0c4c7d75381f2b74425c34adb762c5f.tar.gz |
Remove calls to cout.flush() for AppVeyor
They seemed to produce a hang when running self tests in AppVeyor.
Also use IsDebuggerPresent() to determine when we should call DebugBreak(). The OS killed our debug build when fuzzing caused an assert to fail
-rw-r--r-- | trap.h | 7 | ||||
-rw-r--r-- | validat0.cpp | 11 | ||||
-rw-r--r-- | validat1.cpp | 10 | ||||
-rw-r--r-- | validate.h | 3 |
4 files changed, 11 insertions, 20 deletions
@@ -23,9 +23,8 @@ # if defined(UNIX_SIGNALS_AVAILABLE)
# include "ossig.h"
# elif defined(CRYPTOPP_WIN32_AVAILABLE) && !defined(__CYGWIN__)
-# if (_MSC_VER >= 1400)
-# include <intrin.h>
-# endif
+ extern "C" __declspec(dllimport) void __stdcall DebugBreak();
+ extern "C" __declspec(dllimport) int __stdcall IsDebuggerPresent();
# endif
#endif // CRYPTOPP_DEBUG
@@ -80,7 +79,7 @@ << (int)(__LINE__) << "): " << (char*)(__FUNCTION__) \
<< std::endl; \
std::cerr << oss.str(); \
- __debugbreak(); \
+ if (IsDebuggerPresent()) {DebugBreak();} \
} \
}
#endif // DEBUG and Unix or Windows
diff --git a/validat0.cpp b/validat0.cpp index c4a25c76..a0aa9e61 100644 --- a/validat0.cpp +++ b/validat0.cpp @@ -141,9 +141,6 @@ bool TestPolynomialMod2() std::cout << (!pass2 ? "FAILED" : "passed") << ": " << "0x" << std::hex << word(SIZE_MAX) << std::dec << " shifted over range [" << start << "," << stop << "]" << "\n";
std::cout << (!pass3 ? "FAILED" : "passed") << ": " << "random values shifted over range [" << std::dec << start << "," << stop << "]" << "\n";
- if (!(pass1 && pass2 && pass3))
- std::cout.flush();
-
return pass1 && pass2 && pass3;
}
#endif
@@ -428,7 +425,6 @@ bool TestCompressors() // **************************************************************
- std::cout.flush();
return !fail1 && !fail2 && !fail3;
}
@@ -684,6 +680,7 @@ bool TestSharing() vector_member_ptrs<StringSource> strSources(threshold);
channel.resize(CHID_LENGTH);
+
for (unsigned int i=0; i<threshold; i++)
{
strSources[i].reset(new StringSource(strShares[i], false));
@@ -717,6 +714,7 @@ bool TestSharing() for (unsigned int shares=3; shares<SECRET_SHARES; ++shares)
{
+
std::string message;
unsigned int len = GlobalRNG().GenerateWord32(0, 0xff);
unsigned int threshold = GlobalRNG().GenerateWord32(2, shares-1);
@@ -1226,7 +1224,6 @@ bool TestRounding() std::cout << (fail ? "FAILED:" : "passed:") << " RoundUpToMultipleOf, word128, overflow\n";
#endif
- std::cout.flush();
return pass;
}
#endif
@@ -1305,7 +1302,6 @@ bool RunASN1TestSet(const ASN1_TestTuple asnTuples[], size_t count) pass = !fail && pass;
}
- std::cout.flush();
return pass;
}
@@ -1479,7 +1475,6 @@ bool TestASN1Parse() pass = RunASN1TestSet(integerValues, COUNTOF(integerValues)) && pass;
- std::cout.flush();
return pass;
}
#endif
@@ -2444,7 +2439,6 @@ bool TestSecBlock() std::cout << " FixedSizeAllocator Grow with word128\n";
#endif
- std::cout.flush();
return pass1 && pass2 && pass3 && pass4 && pass5 && pass6 && pass7;
}
#endif
@@ -3212,7 +3206,6 @@ bool TestIntegerBitops() std::cout << "FAILED:";
std::cout << " Bitwise XOR over 32-bits to 1024-bits\n";
- std::cout.flush();
return opa && opo && opx;
}
#endif
diff --git a/validat1.cpp b/validat1.cpp index ee46379c..50d6911d 100644 --- a/validat1.cpp +++ b/validat1.cpp @@ -79,9 +79,10 @@ bool ValidateAll(bool thorough) #if defined(CRYPTOPP_EXTENDED_VALIDATION)
pass=TestMersenne() && pass;
#endif
+#if (CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64)
pass=TestRDRAND() && pass;
pass=TestRDSEED() && pass;
-
+#endif
#if defined(CRYPTOPP_EXTENDED_VALIDATION)
// http://github.com/weidai11/cryptopp/issues/92
pass=TestSecBlock() && pass;
@@ -714,7 +715,6 @@ bool TestRandomPool() }
#endif
- std::cout.flush();
return pass;
}
@@ -809,7 +809,6 @@ bool TestAutoSeededX917() std::cout << "passed:";
std::cout << " GenerateWord32 and Crop\n";
- std::cout.flush();
return pass;
}
#endif
@@ -920,11 +919,11 @@ bool TestMersenne() std::cout << "passed:";
std::cout << " GenerateWord32 and Crop\n";
- std::cout.flush();
return pass;
}
#endif
+#if (CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64)
bool TestRDRAND()
{
std::cout << "\nTesting RDRAND generator...\n\n";
@@ -1024,7 +1023,6 @@ bool TestRDRAND() else
std::cout << "RDRAND generator not available, skipping test.\n";
- std::cout.flush();
return pass;
}
@@ -1127,9 +1125,9 @@ bool TestRDSEED() else
std::cout << "RDSEED generator not available, skipping test.\n";
- std::cout.flush();
return pass;
}
+#endif
bool ValidateHashDRBG()
{
@@ -25,9 +25,10 @@ bool TestRandomPool(); #if !defined(NO_OS_DEPENDENCE)
bool TestAutoSeededX917();
#endif
+#if (CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64)
bool TestRDRAND();
bool TestRDSEED();
-
+#endif
bool ValidateBaseCode();
bool ValidateCRC32();
bool ValidateCRC32C();
|