Skip to content

Commit bd3ec0d

Browse files
apoelstraFabcien
authored andcommitted
[SECP256K1] make test count iteration configurable by environment variable
Summary: ``` You can set the test iteration count by command-line parameter but it is very hard to control the iteration count used by make check and even harder to control the count when this is run through Bitcoin Core's build system. Using an environment var solves both problems. ``` Backport of [[bitcoin-core/secp256k1#851 | secp256k1#851]] Test Plan: SECP256K1_TEST_ITERS=16 ninja check-secp256k1 Should succeed but: SECP256K1_TEST_ITERS=0 ninja check-secp256k1 Should fail with error `An iteration count of 0 or less is not allowed.` Reviewers: #bitcoin_abc, PiRK Reviewed By: #bitcoin_abc, PiRK Differential Revision: https://reviews.bitcoinabc.org/D9375
1 parent 543f9c5 commit bd3ec0d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/secp256k1/src/tests.c

+9
Original file line numberDiff line numberDiff line change
@@ -5635,6 +5635,15 @@ int main(int argc, char **argv) {
56355635
/* find iteration count */
56365636
if (argc > 1) {
56375637
count = strtol(argv[1], NULL, 0);
5638+
} else {
5639+
const char* env = getenv("SECP256K1_TEST_ITERS");
5640+
if (env) {
5641+
count = strtol(env, NULL, 0);
5642+
}
5643+
}
5644+
if (count <= 0) {
5645+
fputs("An iteration count of 0 or less is not allowed.\n", stderr);
5646+
return EXIT_FAILURE;
56385647
}
56395648
printf("test count = %i\n", count);
56405649

0 commit comments

Comments
 (0)