Stop selftest hanging when run on CI

Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
This commit is contained in:
Tom Cosgrove 2023-03-18 14:49:07 +00:00
parent 20458c0963
commit 9149e12767
2 changed files with 12 additions and 3 deletions

View File

@ -70,7 +70,7 @@ jobs:
os: windows os: windows
script: script:
- scripts/windows_msbuild.bat v141 # Visual Studio 2017 - scripts/windows_msbuild.bat v141 # Visual Studio 2017
- visualc/VS2010/x64/Release/selftest.exe - visualc/VS2010/x64/Release/selftest.exe --ci
after_failure: after_failure:
- tests/scripts/travis-log-failure.sh - tests/scripts/travis-log-failure.sh

View File

@ -353,6 +353,9 @@ int main(int argc, char *argv[])
unsigned char buf[1000000]; unsigned char buf[1000000];
#endif #endif
void *pointer; void *pointer;
#if defined(_WIN32)
int ci = 0; /* ci = 1 => running in CI, so don't wait for a key press */
#endif
/* /*
* The C standard doesn't guarantee that all-bits-0 is the representation * The C standard doesn't guarantee that all-bits-0 is the representation
@ -380,6 +383,10 @@ int main(int argc, char *argv[])
} else if (strcmp(*argp, "--exclude") == 0 || } else if (strcmp(*argp, "--exclude") == 0 ||
strcmp(*argp, "-x") == 0) { strcmp(*argp, "-x") == 0) {
exclude_mode = 1; exclude_mode = 1;
#if defined(_WIN32)
} else if (strcmp(*argp, "--ci") == 0) {
ci = 1;
#endif
} else { } else {
break; break;
} }
@ -450,8 +457,10 @@ int main(int argc, char *argv[])
mbedtls_printf(" [ All tests PASS ]\n\n"); mbedtls_printf(" [ All tests PASS ]\n\n");
} }
#if defined(_WIN32) #if defined(_WIN32)
mbedtls_printf(" Press Enter to exit this program.\n"); if (!ci) {
fflush(stdout); getchar(); mbedtls_printf(" Press Enter to exit this program.\n");
fflush(stdout); getchar();
}
#endif #endif
} }