mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-22 22:31:18 -05:00
KWSys 2017-11-01 (6ffca34c)
Code extracted from:
https://gitlab.kitware.com/utils/kwsys.git
at commit 6ffca34c008f0aac44db0e0c2826673a0e3f6ecf (master).
Upstream Shortlog
-----------------
Brad King (2):
7a4cca11 Process: Refactor test compile flag addition
90886a99 Process: Fix tests under ubsan
Bradley Lowekamp (1):
b4507c9c Remove dead code from Configure.h.in
Domen Vrankar (1):
9e0b4d1a SystemTools: set default MakeDirectory permissions mode
This commit is contained in:
committed by
Brad King
parent
e44b0cb2f0
commit
7d3f33e612
+22
-6
@@ -107,6 +107,7 @@ static int test3(int argc, const char* argv[])
|
||||
|
||||
static int test4(int argc, const char* argv[])
|
||||
{
|
||||
#ifndef CRASH_USING_ABORT
|
||||
/* Prepare a pointer to an invalid address. Don't use null, because
|
||||
dereferencing null is undefined behaviour and compilers are free to
|
||||
do whatever they want. ex: Clang will warn at compile time, or even
|
||||
@@ -114,6 +115,7 @@ static int test4(int argc, const char* argv[])
|
||||
'volatile' and a slightly larger address, based on a runtime value. */
|
||||
volatile int* invalidAddress = 0;
|
||||
invalidAddress += argc ? 1 : 2;
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
/* Avoid error diagnostic popups since we are crashing on purpose. */
|
||||
@@ -128,9 +130,13 @@ static int test4(int argc, const char* argv[])
|
||||
fprintf(stderr, "Output before crash on stderr from crash test.\n");
|
||||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
#ifdef CRASH_USING_ABORT
|
||||
abort();
|
||||
#else
|
||||
assert(invalidAddress); /* Quiet Clang scan-build. */
|
||||
/* Provoke deliberate crash by writing to the invalid address. */
|
||||
*invalidAddress = 0;
|
||||
#endif
|
||||
fprintf(stdout, "Output after crash on stdout from crash test.\n");
|
||||
fprintf(stderr, "Output after crash on stderr from crash test.\n");
|
||||
return 0;
|
||||
@@ -149,7 +155,12 @@ static int test5(int argc, const char* argv[])
|
||||
fprintf(stderr, "Output on stderr before recursive test.\n");
|
||||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
r = runChild(cmd, kwsysProcess_State_Exception, kwsysProcess_Exception_Fault,
|
||||
r = runChild(cmd, kwsysProcess_State_Exception,
|
||||
#ifdef CRASH_USING_ABORT
|
||||
kwsysProcess_Exception_Other,
|
||||
#else
|
||||
kwsysProcess_Exception_Fault,
|
||||
#endif
|
||||
1, 1, 1, 0, 15, 0, 1, 0, 0, 0);
|
||||
fprintf(stdout, "Output on stdout after recursive test.\n");
|
||||
fprintf(stderr, "Output on stderr after recursive test.\n");
|
||||
@@ -628,11 +639,16 @@ int main(int argc, const char* argv[])
|
||||
kwsysProcess_State_Exception /* Process group test */
|
||||
};
|
||||
int exceptions[10] = {
|
||||
kwsysProcess_Exception_None, kwsysProcess_Exception_None,
|
||||
kwsysProcess_Exception_None, kwsysProcess_Exception_Fault,
|
||||
kwsysProcess_Exception_None, kwsysProcess_Exception_None,
|
||||
kwsysProcess_Exception_None, kwsysProcess_Exception_None,
|
||||
kwsysProcess_Exception_None, kwsysProcess_Exception_Interrupt
|
||||
kwsysProcess_Exception_None, kwsysProcess_Exception_None,
|
||||
kwsysProcess_Exception_None,
|
||||
#ifdef CRASH_USING_ABORT
|
||||
kwsysProcess_Exception_Other,
|
||||
#else
|
||||
kwsysProcess_Exception_Fault,
|
||||
#endif
|
||||
kwsysProcess_Exception_None, kwsysProcess_Exception_None,
|
||||
kwsysProcess_Exception_None, kwsysProcess_Exception_None,
|
||||
kwsysProcess_Exception_None, kwsysProcess_Exception_Interrupt
|
||||
};
|
||||
int values[10] = { 0, 123, 1, 1, 0, 0, 0, 0, 1, 1 };
|
||||
int shares[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1 };
|
||||
|
||||
Reference in New Issue
Block a user