From cf0d96dd0bf6e30fa2d836bdd8a02aff1a5735b4 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Mon, 24 Mar 2014 11:41:01 +0000 Subject: [PATCH] Ensure that all test cases call testlib_init so that the testlib assertion handler is installed: this ensures that on windows you can set mps_testlib_noabort to avoid the dialog box from abort(). Copied from Perforce Change: 184965 ServerID: perforce.ravenbrook.com --- mps/code/abqtest.c | 7 +++---- mps/code/amcss.c | 7 +++---- mps/code/amcsshe.c | 7 +++---- mps/code/amcssth.c | 7 +++---- mps/code/amsss.c | 7 +++---- mps/code/amssshe.c | 7 +++---- mps/code/apss.c | 7 +++---- mps/code/arenacv.c | 7 ++++--- mps/code/awlut.c | 7 +++---- mps/code/awluthe.c | 7 +++---- mps/code/awlutth.c | 7 +++---- mps/code/btcv.c | 7 +++---- mps/code/bttest.c | 6 +++--- mps/code/exposet0.c | 7 +++---- mps/code/expt825.c | 7 ++++--- mps/code/fbmtest.c | 6 +++--- mps/code/finalcv.c | 7 +++---- mps/code/finaltest.c | 7 ++++--- mps/code/fotest.c | 7 +++---- mps/code/locbwcss.c | 3 +-- mps/code/lockcov.c | 7 ++++--- mps/code/lockutw3.c | 6 ++++-- mps/code/locusss.c | 4 +--- mps/code/locv.c | 7 ++++--- mps/code/messtest.c | 7 +++---- mps/code/mpmss.c | 7 +++---- mps/code/mpsicv.c | 7 +++---- mps/code/mv2test.c | 6 +++--- mps/code/poolncv.c | 6 +++--- mps/code/qs.c | 7 +++---- mps/code/sacss.c | 7 +++---- mps/code/segsmss.c | 7 +++---- mps/code/steptest.c | 7 +++---- mps/code/teletest.c | 7 +++---- mps/code/testlib.c | 12 ++++++++++-- mps/code/testlib.h | 5 +++++ mps/code/walkt0.c | 7 +++---- mps/code/zcoll.c | 7 +++---- mps/code/zmess.c | 8 +++----- 39 files changed, 128 insertions(+), 137 deletions(-) diff --git a/mps/code/abqtest.c b/mps/code/abqtest.c index f8e3a2a4bd4..350f0e89f86 100644 --- a/mps/code/abqtest.c +++ b/mps/code/abqtest.c @@ -1,7 +1,7 @@ /* abqtest.c: AVAILABLE BLOCK QUEUE TEST * * $Id$ - * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. */ #include "abq.h" @@ -154,8 +154,7 @@ extern int main(int argc, char *argv[]) mps_arena_t arena; int i; - randomize(argc, argv); - mps_lib_assert_fail_install(assert_die); + testlib_init(argc, argv); abqSize = 0; @@ -178,7 +177,7 @@ extern int main(int argc, char *argv[]) /* C. COPYRIGHT AND LICENSE * - * Copyright (c) 2001-2013 Ravenbrook Limited . + * Copyright (c) 2001-2014 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/mps/code/amcss.c b/mps/code/amcss.c index e3bb32627eb..bf0c6611174 100644 --- a/mps/code/amcss.c +++ b/mps/code/amcss.c @@ -1,7 +1,7 @@ /* amcss.c: POOL CLASS AMC STRESS TEST * * $Id$ - * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. * Portions copyright (C) 2002 Global Graphics Software. */ @@ -306,8 +306,7 @@ int main(int argc, char *argv[]) mps_arena_t arena; mps_thr_t thread; - randomize(argc, argv); - mps_lib_assert_fail_install(assert_die); + testlib_init(argc, argv); die(mps_arena_create(&arena, mps_arena_class_vm(), 2*testArenaSIZE), "arena_create"); @@ -331,7 +330,7 @@ int main(int argc, char *argv[]) /* C. COPYRIGHT AND LICENSE * - * Copyright (c) 2001-2013 Ravenbrook Limited . + * Copyright (c) 2001-2014 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/mps/code/amcsshe.c b/mps/code/amcsshe.c index de8eec82a3a..5ad7c064f5d 100644 --- a/mps/code/amcsshe.c +++ b/mps/code/amcsshe.c @@ -1,7 +1,7 @@ /* amcsshe.c: POOL CLASS AMC STRESS TEST WITH HEADER * * $Id$ - * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. * Portions copyright (c) 2002 Global Graphics Software. */ @@ -262,8 +262,7 @@ int main(int argc, char *argv[]) mps_thr_t thread; void *r; - randomize(argc, argv); - mps_lib_assert_fail_install(assert_die); + testlib_init(argc, argv); die(mps_arena_create(&arena, mps_arena_class_vm(), 3*testArenaSIZE), "arena_create\n"); @@ -285,7 +284,7 @@ int main(int argc, char *argv[]) /* C. COPYRIGHT AND LICENSE * - * Copyright (c) 2001-2013 Ravenbrook Limited . + * Copyright (c) 2001-2014 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/mps/code/amcssth.c b/mps/code/amcssth.c index e7f8f88233a..f01dbaf9d6b 100644 --- a/mps/code/amcssth.c +++ b/mps/code/amcssth.c @@ -1,7 +1,7 @@ /* amcssth.c: POOL CLASS AMC STRESS TEST WITH TWO THREADS * * $Id$ - * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. * Portions copyright (c) 2002 Global Graphics Software. * * .posix: This is Posix only. @@ -322,8 +322,7 @@ int main(int argc, char *argv[]) void *r; int childIsFinished = 0; - randomize(argc, argv); - mps_lib_assert_fail_install(assert_die); + testlib_init(argc, argv); die(mps_arena_create(&arena, mps_arena_class_vm(), testArenaSIZE), "arena_create"); @@ -358,7 +357,7 @@ int main(int argc, char *argv[]) /* C. COPYRIGHT AND LICENSE * - * Copyright (c) 2001-2013 Ravenbrook Limited . + * Copyright (c) 2001-2014 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/mps/code/amsss.c b/mps/code/amsss.c index 43d2541f401..a0a1fe666e6 100644 --- a/mps/code/amsss.c +++ b/mps/code/amsss.c @@ -1,7 +1,7 @@ /* amsss.c: POOL CLASS AMS STRESS TEST * * $Id$ - * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. * Portions copyright (c) 2002 Global Graphics Software. * * .design: Adapted from amcss.c, but not counting collections, just @@ -207,8 +207,7 @@ int main(int argc, char *argv[]) mps_pool_t pool; void *r; - randomize(argc, argv); - mps_lib_assert_fail_install(assert_die); + testlib_init(argc, argv); die(mps_arena_create(&arena, mps_arena_class_vm(), testArenaSIZE), "arena_create"); @@ -280,7 +279,7 @@ int main(int argc, char *argv[]) /* C. COPYRIGHT AND LICENSE * - * Copyright (c) 2001-2013 Ravenbrook Limited . + * Copyright (c) 2001-2014 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/mps/code/amssshe.c b/mps/code/amssshe.c index ddbda607017..4787ef80e6f 100644 --- a/mps/code/amssshe.c +++ b/mps/code/amssshe.c @@ -1,7 +1,7 @@ /* amssshe.c: POOL CLASS AMS STRESS TEST WITH HEADERS * * $Id$ - * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. * * .design: Adapted from amsss.c. */ @@ -162,8 +162,7 @@ int main(int argc, char *argv[]) mps_thr_t thread; void *r; - randomize(argc, argv); - mps_lib_assert_fail_install(assert_die); + testlib_init(argc, argv); die(mps_arena_create(&arena, mps_arena_class_vm(), testArenaSIZE), "arena_create"); @@ -179,7 +178,7 @@ int main(int argc, char *argv[]) /* C. COPYRIGHT AND LICENSE * - * Copyright (c) 2001-2013 Ravenbrook Limited . + * Copyright (c) 2001-2014 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/mps/code/apss.c b/mps/code/apss.c index a8d1a7660de..aaa5da0957b 100644 --- a/mps/code/apss.c +++ b/mps/code/apss.c @@ -1,7 +1,7 @@ /* apss.c: AP MANUAL ALLOC STRESS TEST * * $Id$ - * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. * Portions copyright (C) 2002 Global Graphics Software. */ @@ -190,8 +190,7 @@ int main(int argc, char *argv[]) bothOptions = MPS_PF_ALIGN == 8 ? &bothOptions8 : &bothOptions16; - randomize(argc, argv); - mps_lib_assert_fail_install(assert_die); + testlib_init(argc, argv); die(mps_arena_create(&arena, mps_arena_class_vm(), 2*testArenaSIZE), "mps_arena_create"); @@ -226,7 +225,7 @@ int main(int argc, char *argv[]) /* C. COPYRIGHT AND LICENSE * - * Copyright (c) 2001-2013 Ravenbrook Limited . + * Copyright (c) 2001-2014 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/mps/code/arenacv.c b/mps/code/arenacv.c index 12ae42ff721..8b149c194bd 100644 --- a/mps/code/arenacv.c +++ b/mps/code/arenacv.c @@ -1,7 +1,7 @@ /* arenacv.c: ARENA COVERAGE TEST * * $Id$ - * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. * * .coverage: At the moment, we're only trying to cover the new code * (partial mapping of the page table and vm overflow). @@ -399,7 +399,8 @@ static void testSize(Size size) int main(int argc, char *argv[]) { void *block; - testlib_unused(argc); + + testlib_init(argc, argv); testPageTable((ArenaClass)mps_arena_class_vm(), TEST_ARENA_SIZE, 0, TRUE); testPageTable((ArenaClass)mps_arena_class_vm(), TEST_ARENA_SIZE, 0, FALSE); @@ -417,7 +418,7 @@ int main(int argc, char *argv[]) /* C. COPYRIGHT AND LICENSE * - * Copyright (c) 2001-2013 Ravenbrook Limited . + * Copyright (c) 2001-2014 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/mps/code/awlut.c b/mps/code/awlut.c index 25ceb34b29b..8af4bcd4bbc 100644 --- a/mps/code/awlut.c +++ b/mps/code/awlut.c @@ -1,7 +1,7 @@ /* awlut.c: POOL CLASS AWL UNIT TEST * * $Id$ - * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. * * DESIGN * @@ -316,8 +316,7 @@ int main(int argc, char *argv[]) mps_thr_t thread; void *r; - randomize(argc, argv); - mps_lib_assert_fail_install(assert_die); + testlib_init(argc, argv); initialise_wrapper(wrapper_wrapper); initialise_wrapper(string_wrapper); @@ -339,7 +338,7 @@ int main(int argc, char *argv[]) /* C. COPYRIGHT AND LICENSE * - * Copyright (c) 2001-2013 Ravenbrook Limited . + * Copyright (c) 2001-2014 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/mps/code/awluthe.c b/mps/code/awluthe.c index 6b56d05f78d..9fb1281dcc1 100644 --- a/mps/code/awluthe.c +++ b/mps/code/awluthe.c @@ -1,7 +1,7 @@ /* awluthe.c: POOL CLASS AWL UNIT TEST WITH OBJECT HEADERS * * $Id$ - * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. * * DESIGN * @@ -319,8 +319,7 @@ int main(int argc, char *argv[]) mps_thr_t thread; void *r; - randomize(argc, argv); - mps_lib_assert_fail_install(assert_die); + testlib_init(argc, argv); initialise_wrapper(wrapper_wrapper); initialise_wrapper(string_wrapper); @@ -342,7 +341,7 @@ int main(int argc, char *argv[]) /* C. COPYRIGHT AND LICENSE * - * Copyright (c) 2001-2013 Ravenbrook Limited . + * Copyright (c) 2001-2014 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/mps/code/awlutth.c b/mps/code/awlutth.c index c937535a0cf..f12d8913543 100644 --- a/mps/code/awlutth.c +++ b/mps/code/awlutth.c @@ -1,7 +1,7 @@ /* awlutth.c: THREADING UNIT TEST USING POOL CLASS AWL * * $Id$ - * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. * * DESIGN * @@ -316,8 +316,7 @@ int main(int argc, char *argv[]) mps_arena_t arena; pthread_t pthread1; - randomize(argc, argv); - mps_lib_assert_fail_install(assert_die); + testlib_init(argc, argv); initialise_wrapper(wrapper_wrapper); initialise_wrapper(string_wrapper); @@ -337,7 +336,7 @@ int main(int argc, char *argv[]) /* C. COPYRIGHT AND LICENSE * - * Copyright (c) 2001-2013 Ravenbrook Limited . + * Copyright (c) 2001-2014 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/mps/code/btcv.c b/mps/code/btcv.c index 72256a5f693..414c3351161 100644 --- a/mps/code/btcv.c +++ b/mps/code/btcv.c @@ -1,7 +1,7 @@ /* btss.c: BIT TABLE COVERAGE TEST * * $Id$ - * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. * * .readership: MPS developers * @@ -550,8 +550,7 @@ int main(int argc, char *argv[]) /* tests need 4 whole words plus a few extra bits */ btSize = MPS_WORD_WIDTH * 4 + 10; - testlib_unused(argc); - testlib_unused(argv); + testlib_init(argc, argv); die(mps_arena_create(&mpsArena, mps_arena_class_vm(), testArenaSIZE), "mps_arena_create"); @@ -572,7 +571,7 @@ int main(int argc, char *argv[]) /* C. COPYRIGHT AND LICENSE * - * Copyright (c) 2001-2013 Ravenbrook Limited . + * Copyright (c) 2001-2014 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/mps/code/bttest.c b/mps/code/bttest.c index ea2b00849b8..12a6bd8503f 100644 --- a/mps/code/bttest.c +++ b/mps/code/bttest.c @@ -1,7 +1,7 @@ /* bttest.c: BIT TABLE TEST * * $Id$ - * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. */ @@ -366,7 +366,7 @@ extern int main(int argc, char *argv[]) bt = NULL; btSize = 0; - testlib_unused(argc); testlib_unused(argv); + testlib_init(argc, argv); die(mps_arena_create((mps_arena_t*)&arena, mps_arena_class_vm(), testArenaSIZE), @@ -387,7 +387,7 @@ extern int main(int argc, char *argv[]) /* C. COPYRIGHT AND LICENSE * - * Copyright (C) 2001-2013 Ravenbrook Limited . + * Copyright (C) 2001-2014 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/mps/code/exposet0.c b/mps/code/exposet0.c index b204b59d265..739ccac1e6a 100644 --- a/mps/code/exposet0.c +++ b/mps/code/exposet0.c @@ -1,7 +1,7 @@ /* exposet0.c: ARENA EXPOSE TEST * * $Id$ - * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. * Portions copyright (C) 2002 Global Graphics Software. * * The primary purpose of this test is to test that mps_arena_expose does @@ -255,8 +255,7 @@ int main(int argc, char *argv[]) mps_thr_t thread; void *r; - randomize(argc, argv); - mps_lib_assert_fail_install(assert_die); + testlib_init(argc, argv); die(mps_arena_create(&arena, mps_arena_class_vm(), 2*testArenaSIZE), "arena_create"); @@ -275,7 +274,7 @@ int main(int argc, char *argv[]) /* C. COPYRIGHT AND LICENSE * - * Copyright (c) 2001-2013 Ravenbrook Limited . + * Copyright (c) 2001-2014 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/mps/code/expt825.c b/mps/code/expt825.c index 9c7c4556d77..e18905061cf 100644 --- a/mps/code/expt825.c +++ b/mps/code/expt825.c @@ -1,7 +1,7 @@ /* expt825.c: Test for bug described in job000825 * * $Id$ - * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. * Portions copyright (C) 2002 Global Graphics Software. * * DESIGN @@ -262,7 +262,8 @@ int main(int argc, char *argv[]) mps_arena_t arena; mps_thr_t thread; void *r; - testlib_unused(argc); + + testlib_init(argc, argv); die(mps_arena_create(&arena, mps_arena_class_vm(), testArenaSIZE), "arena_create\n"); @@ -278,7 +279,7 @@ int main(int argc, char *argv[]) /* C. COPYRIGHT AND LICENSE * - * Copyright (c) 2001-2013 Ravenbrook Limited . + * Copyright (c) 2001-2014 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/mps/code/fbmtest.c b/mps/code/fbmtest.c index 8465234475e..905e90d0a93 100644 --- a/mps/code/fbmtest.c +++ b/mps/code/fbmtest.c @@ -1,7 +1,7 @@ /* fbmtest.c: FREE BLOCK MANAGEMENT TEST * * $Id$ - * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. * * The MPS contains two free block management modules: * @@ -560,7 +560,7 @@ extern int main(int argc, char *argv[]) CBSStruct cbsStruct; Align align; - randomize(argc, argv); + testlib_init(argc, argv); align = (1 << rnd() % 4) * MPS_PF_ALIGN; NAllocateTried = NAllocateSucceeded = NDeallocateTried = @@ -616,7 +616,7 @@ extern int main(int argc, char *argv[]) /* C. COPYRIGHT AND LICENSE * - * Copyright (c) 2001-2013 Ravenbrook Limited . + * Copyright (c) 2001-2014 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/mps/code/finalcv.c b/mps/code/finalcv.c index 8236df4279b..daed57c7311 100644 --- a/mps/code/finalcv.c +++ b/mps/code/finalcv.c @@ -1,7 +1,7 @@ /* finalcv.c: FINALIZATION COVERAGE TEST * * $Id$ - * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. * Portions copyright (C) 2002 Global Graphics Software. * * DESIGN @@ -217,8 +217,7 @@ int main(int argc, char *argv[]) mps_thr_t thread; void *r; - randomize(argc, argv); - mps_lib_assert_fail_install(assert_die); + testlib_init(argc, argv); die(mps_arena_create(&arena, mps_arena_class_vm(), testArenaSIZE), "arena_create\n"); @@ -234,7 +233,7 @@ int main(int argc, char *argv[]) /* C. COPYRIGHT AND LICENSE * - * Copyright (c) 2001-2013 Ravenbrook Limited . + * Copyright (c) 2001-2014 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/mps/code/finaltest.c b/mps/code/finaltest.c index f5ef8a9a99f..205cfefd5ad 100644 --- a/mps/code/finaltest.c +++ b/mps/code/finaltest.c @@ -1,7 +1,7 @@ /* finaltest.c: LARGE-SCALE FINALIZATION TEST * * $Id$ - * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. * Portions copyright (C) 2002 Global Graphics Software. * * DESIGN @@ -245,7 +245,8 @@ int main(int argc, char *argv[]) mps_arena_t arena; mps_thr_t thread; void *r; - testlib_unused(argc); + + testlib_init(argc, argv); die(mps_arena_create(&arena, mps_arena_class_vm(), testArenaSIZE), "arena_create\n"); @@ -261,7 +262,7 @@ int main(int argc, char *argv[]) /* C. COPYRIGHT AND LICENSE * - * Copyright (c) 2001-2013 Ravenbrook Limited . + * Copyright (c) 2001-2014 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/mps/code/fotest.c b/mps/code/fotest.c index cab1d0f4e31..ada5f6dec67 100644 --- a/mps/code/fotest.c +++ b/mps/code/fotest.c @@ -1,7 +1,7 @@ /* fotest.c: FAIL-OVER TEST * * $Id$ - * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. * Portions copyright (C) 2002 Global Graphics Software. * * This tests fail-over behaviour in low memory situations. The MVFF @@ -170,8 +170,7 @@ int main(int argc, char *argv[]) mps_pool_t pool; mps_align_t alignment; - randomize(argc, argv); - mps_lib_assert_fail_install(assert_die); + testlib_init(argc, argv); die(mps_arena_create(&arena, mps_arena_class_vm(), testArenaSIZE), "mps_arena_create"); @@ -218,7 +217,7 @@ int main(int argc, char *argv[]) /* C. COPYRIGHT AND LICENSE * - * Copyright (c) 2001-2013 Ravenbrook Limited . + * Copyright (c) 2001-2014 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/mps/code/locbwcss.c b/mps/code/locbwcss.c index 40f21576270..5807d9c1f7b 100644 --- a/mps/code/locbwcss.c +++ b/mps/code/locbwcss.c @@ -193,8 +193,7 @@ int main(int argc, char *argv[]) { mps_arena_t arena; - randomize(argc, argv); - mps_lib_assert_fail_install(assert_die); + testlib_init(argc, argv); MPS_ARGS_BEGIN(args) { MPS_ARGS_ADD(args, MPS_KEY_ARENA_SIZE, testArenaSIZE); diff --git a/mps/code/lockcov.c b/mps/code/lockcov.c index 28c398e4bba..a8237f7de72 100644 --- a/mps/code/lockcov.c +++ b/mps/code/lockcov.c @@ -1,7 +1,7 @@ /* lockcov.c: LOCK COVERAGE TEST * * $Id$ - * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. */ #include "mpm.h" @@ -14,7 +14,8 @@ int main(int argc, char *argv[]) { Lock a = malloc(LockSize()); Lock b = malloc(LockSize()); - testlib_unused(argc); + + testlib_init(argc, argv); Insist(a != NULL); Insist(b != NULL); @@ -53,7 +54,7 @@ int main(int argc, char *argv[]) /* C. COPYRIGHT AND LICENSE * - * Copyright (c) 2001-2013 Ravenbrook Limited . + * Copyright (c) 2001-2014 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/mps/code/lockutw3.c b/mps/code/lockutw3.c index c66db7edd77..da5070ecab7 100644 --- a/mps/code/lockutw3.c +++ b/mps/code/lockutw3.c @@ -1,7 +1,7 @@ /* lockutw3.c: LOCK UTILIZATION TEST * * $Id$ - * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. */ #include "mpm.h" @@ -71,6 +71,8 @@ int main(int argc, char *argv[]) HANDLE t[10]; unsigned i; + testlib_init(argc, argv); + lock = malloc(LockSize()); Insist(lock != NULL); @@ -96,7 +98,7 @@ int main(int argc, char *argv[]) /* C. COPYRIGHT AND LICENSE * - * Copyright (c) 2001-2013 Ravenbrook Limited . + * Copyright (c) 2001-2014 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/mps/code/locusss.c b/mps/code/locusss.c index f293ae7c7b5..b399e58e8da 100644 --- a/mps/code/locusss.c +++ b/mps/code/locusss.c @@ -237,9 +237,7 @@ static void runArenaTest(size_t size, int main(int argc, char *argv[]) { - - randomize(argc, argv); - mps_lib_assert_fail_install(assert_die); + testlib_init(argc, argv); printf("\nRunning test with no information about peak usage.\n"); runArenaTest(smallArenaSize, FALSE, FALSE); diff --git a/mps/code/locv.c b/mps/code/locv.c index 29881f6c54e..56c9a46d2c5 100644 --- a/mps/code/locv.c +++ b/mps/code/locv.c @@ -1,7 +1,7 @@ /* locv.c: LEAF OBJECT POOL CLASS COVERAGE TEST * * $Id$ - * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. * * This is (not much of) a coverage test for the Leaf Object * pool (PoolClassLO). @@ -48,7 +48,8 @@ int main(int argc, char *argv[]) mps_ap_t ap; mps_addr_t p; mps_root_t root; - testlib_unused(argc); + + testlib_init(argc, argv); locv_fmt.align = sizeof(void *); /* .fmt.align.delayed */ @@ -169,7 +170,7 @@ static void stepper(mps_addr_t addr, mps_fmt_t fmt, mps_pool_t pool, /* C. COPYRIGHT AND LICENSE * - * Copyright (c) 2001-2013 Ravenbrook Limited . + * Copyright (c) 2001-2014 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/mps/code/messtest.c b/mps/code/messtest.c index b7e178b483d..7f96360f78e 100644 --- a/mps/code/messtest.c +++ b/mps/code/messtest.c @@ -1,7 +1,7 @@ /* messtest.c: MESSAGE TEST * * $Id$ - * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. */ #include "mpm.h" @@ -261,8 +261,7 @@ extern int main(int argc, char *argv[]) mps_arena_t mpsArena; Arena arena; - testlib_unused(argc); - testlib_unused(argv); + testlib_init(argc, argv); die(mps_arena_create(&mpsArena, mps_arena_class_vm(), testArenaSIZE), "mps_arena_create"); @@ -279,7 +278,7 @@ extern int main(int argc, char *argv[]) /* C. COPYRIGHT AND LICENSE * - * Copyright (c) 2001-2013 Ravenbrook Limited . + * Copyright (c) 2001-2014 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/mps/code/mpmss.c b/mps/code/mpmss.c index c18c4fe07dd..76fbf12c3fe 100644 --- a/mps/code/mpmss.c +++ b/mps/code/mpmss.c @@ -1,7 +1,7 @@ /* mpmss.c: MPM STRESS TEST * * $Id$ - * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. * Portions copyright (C) 2002 Global Graphics Software. */ @@ -188,8 +188,7 @@ int main(int argc, char *argv[]) bothOptions = MPS_PF_ALIGN == 8 ? &bothOptions8 : &bothOptions16; - randomize(argc, argv); - mps_lib_assert_fail_install(assert_die); + testlib_init(argc, argv); die(mps_arena_create(&arena, mps_arena_class_vm(), testArenaSIZE), "mps_arena_create"); @@ -208,7 +207,7 @@ int main(int argc, char *argv[]) /* C. COPYRIGHT AND LICENSE * - * Copyright (c) 2001-2013 Ravenbrook Limited . + * Copyright (c) 2001-2014 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/mps/code/mpsicv.c b/mps/code/mpsicv.c index 142498a4502..3f8d05b92e0 100644 --- a/mps/code/mpsicv.c +++ b/mps/code/mpsicv.c @@ -1,7 +1,7 @@ /* mpsicv.c: MPSI COVERAGE TEST * * $Id$ - * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. * Portions copyright (c) 2002 Global Graphics Software. */ @@ -583,8 +583,7 @@ int main(int argc, char *argv[]) void *r; void *marker = ▮ - randomize(argc, argv); - mps_lib_assert_fail_install(assert_die); + testlib_init(argc, argv); die(mps_arena_create(&arena, mps_arena_class_vm(), TEST_ARENA_SIZE), "arena_create"); @@ -609,7 +608,7 @@ int main(int argc, char *argv[]) /* C. COPYRIGHT AND LICENSE * - * Copyright (c) 2001-2013 Ravenbrook Limited . + * Copyright (c) 2001-2014 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/mps/code/mv2test.c b/mps/code/mv2test.c index 3302471e733..bc276abfc26 100644 --- a/mps/code/mv2test.c +++ b/mps/code/mv2test.c @@ -1,7 +1,7 @@ /* mv2test.c: POOLMVT STRESS TEST * * $Id$ - * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. */ #include @@ -203,7 +203,7 @@ static void stress_with_arena_class(mps_arena_class_t aclass, Bool zoned) int main(int argc, char *argv[]) { - randomize(argc, argv); + testlib_init(argc, argv); stress_with_arena_class(mps_arena_class_vm(), TRUE); stress_with_arena_class(mps_arena_class_vm(), FALSE); @@ -215,7 +215,7 @@ int main(int argc, char *argv[]) /* C. COPYRIGHT AND LICENSE * - * Copyright (c) 2001-2013 Ravenbrook Limited . + * Copyright (c) 2001-2014 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/mps/code/poolncv.c b/mps/code/poolncv.c index deee10715da..6d77542db58 100644 --- a/mps/code/poolncv.c +++ b/mps/code/poolncv.c @@ -1,7 +1,7 @@ /* poolncv.c: NULL POOL COVERAGE TEST * * $Id$ - * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. */ #include "mpm.h" @@ -33,7 +33,7 @@ static void testit(ArenaClass class, ArgList args) int main(int argc, char *argv[]) { - testlib_unused(argc); + testlib_init(argc, argv); MPS_ARGS_BEGIN(args) { MPS_ARGS_ADD(args, MPS_KEY_ARENA_SIZE, 600000); testit((ArenaClass)mps_arena_class_vm(), args); @@ -45,7 +45,7 @@ int main(int argc, char *argv[]) /* C. COPYRIGHT AND LICENSE * - * Copyright (c) 2001-2013 Ravenbrook Limited . + * Copyright (c) 2001-2014 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/mps/code/qs.c b/mps/code/qs.c index 13b2070da19..40e290dceec 100644 --- a/mps/code/qs.c +++ b/mps/code/qs.c @@ -1,7 +1,7 @@ /* qs.c: QUICKSORT * * $Id$ - * Copyright (c) 2001 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. * * The purpose of this program is to act as a "real" client of the MM. * It is a test, but (hopefully) less contrived than some of the other @@ -528,8 +528,7 @@ int main(int argc, char *argv[]) { void *r; - randomize(argc, argv); - mps_lib_assert_fail_install(assert_die); + testlib_init(argc, argv); die(mps_arena_create(&arena, mps_arena_class_vm(), testArenaSIZE), "mps_arena_create"); @@ -543,7 +542,7 @@ int main(int argc, char *argv[]) /* C. COPYRIGHT AND LICENSE * - * Copyright (c) 2001-2013 Ravenbrook Limited . + * Copyright (c) 2001-2014 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/mps/code/sacss.c b/mps/code/sacss.c index 1f9a855b32c..a5fc3734029 100644 --- a/mps/code/sacss.c +++ b/mps/code/sacss.c @@ -1,7 +1,7 @@ /* sacss.c: SAC MANUAL ALLOC STRESS TEST * * $Id$ - * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. * Portions copyright (C) 2002 Global Graphics Software. */ @@ -191,8 +191,7 @@ int main(int argc, char *argv[]) { mps_arena_t arena; - randomize(argc, argv); - mps_lib_assert_fail_install(assert_die); + testlib_init(argc, argv); die(mps_arena_create(&arena, mps_arena_class_vm(), testArenaSIZE), "mps_arena_create"); @@ -216,7 +215,7 @@ int main(int argc, char *argv[]) /* C. COPYRIGHT AND LICENSE * - * Copyright (c) 2001-2013 Ravenbrook Limited . + * Copyright (c) 2001-2014 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/mps/code/segsmss.c b/mps/code/segsmss.c index 2e071e6dc0f..06c6b7c01fb 100644 --- a/mps/code/segsmss.c +++ b/mps/code/segsmss.c @@ -1,7 +1,7 @@ /* segsmss.c: Segment splitting and merging stress test * * $Id$ - * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. * Portions copyright (c) 2002 Global Graphics Software. * * .design: Adapted from amsss.c (because AMS already supports @@ -854,8 +854,7 @@ int main(int argc, char *argv[]) mps_thr_t thread; void *r; - randomize(argc, argv); - mps_lib_assert_fail_install(assert_die); + testlib_init(argc, argv); die(mps_arena_create(&arena, mps_arena_class_vm(), testArenaSIZE), "arena_create"); @@ -871,7 +870,7 @@ int main(int argc, char *argv[]) /* C. COPYRIGHT AND LICENSE * - * Copyright (c) 2001-2013 Ravenbrook Limited . + * Copyright (c) 2001-2014 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/mps/code/steptest.c b/mps/code/steptest.c index c01b81f21e1..73cc730b790 100644 --- a/mps/code/steptest.c +++ b/mps/code/steptest.c @@ -1,7 +1,7 @@ /* steptest.c: TEST FOR ARENA STEPPING * * $Id$ - * Copyright (c) 1998-2013 Ravenbrook Limited. See end of file for license. + * Copyright (c) 1998-2014 Ravenbrook Limited. See end of file for license. * * Loosely based on . */ @@ -492,8 +492,7 @@ int main(int argc, char *argv[]) { prepare_clock(); - randomize(argc, argv); - mps_lib_assert_fail_install(assert_die); + testlib_init(argc, argv); while (test_number < TESTS) { mps_arena_t arena; @@ -519,7 +518,7 @@ int main(int argc, char *argv[]) /* C. COPYRIGHT AND LICENSE * - * Copyright (c) 2001-2013 Ravenbrook Limited . + * Copyright (c) 2001-2014 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/mps/code/teletest.c b/mps/code/teletest.c index 5f54dc61102..17002585133 100644 --- a/mps/code/teletest.c +++ b/mps/code/teletest.c @@ -1,7 +1,7 @@ /* teletest.c: TELEMETRY TEST * * $Id$ - * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. * * .source: The command parser here was taken and adapted from bttest.c. */ @@ -200,8 +200,7 @@ static void obeyCommand(char *command) extern int main(int argc, char *argv[]) { - testlib_unused(argc); - testlib_unused(argv); + testlib_init(argc, argv); die(mps_arena_create((mps_arena_t*)&arena, mps_arena_class_vm(), testArenaSIZE), @@ -223,7 +222,7 @@ extern int main(int argc, char *argv[]) /* C. COPYRIGHT AND LICENSE * - * Copyright (C) 2001-2013 Ravenbrook Limited . + * Copyright (C) 2001-2014 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/mps/code/testlib.c b/mps/code/testlib.c index 2bed23b0f6f..8ef14ca3c78 100644 --- a/mps/code/testlib.c +++ b/mps/code/testlib.c @@ -1,7 +1,7 @@ /* testlib.c: TEST LIBRARY * * $Id$ - * Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license. * Portions copyright (C) 2002 Global Graphics Software. * * .purpose: A library of functions that may be of use to unit tests. @@ -409,10 +409,18 @@ void assert_die(const char *file, unsigned line, const char *condition) } +/* testlib_init -- install assertion handler and seed RNG */ + +void testlib_init(int argc, char *argv[]) +{ + mps_lib_assert_fail_install(assert_die); + randomize(argc, argv); +} + /* C. COPYRIGHT AND LICENSE * - * Copyright (c) 2001-2013 Ravenbrook Limited . + * Copyright (c) 2001-2014 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/mps/code/testlib.h b/mps/code/testlib.h index d58655ca246..d36f26a275c 100644 --- a/mps/code/testlib.h +++ b/mps/code/testlib.h @@ -227,6 +227,11 @@ extern double rnd_double(void); extern void randomize(int argc, char *argv[]); +/* testlib_init -- install assertion handler and seed RNG */ + +extern void testlib_init(int argc, char *argv[]); + + #endif /* testlib_h */ diff --git a/mps/code/walkt0.c b/mps/code/walkt0.c index 3e8c8ce8293..3365874c153 100644 --- a/mps/code/walkt0.c +++ b/mps/code/walkt0.c @@ -1,7 +1,7 @@ /* walkt0.c: WALK TEST 0 * * $Id$ - * Copyright (c) 1998-2013 Ravenbrook Limited. See end of file for license. + * Copyright (c) 1998-2014 Ravenbrook Limited. See end of file for license. * * Loosely based on . */ @@ -201,8 +201,7 @@ int main(int argc, char *argv[]) mps_thr_t thread; void *r; - randomize(argc, argv); - mps_lib_assert_fail_install(assert_die); + testlib_init(argc, argv); die(mps_arena_create(&arena, mps_arena_class_vm(), testArenaSIZE), @@ -219,7 +218,7 @@ int main(int argc, char *argv[]) /* C. COPYRIGHT AND LICENSE * - * Copyright (c) 2001-2013 Ravenbrook Limited . + * Copyright (c) 2001-2014 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/mps/code/zcoll.c b/mps/code/zcoll.c index 66b4d268b8d..639a323957a 100644 --- a/mps/code/zcoll.c +++ b/mps/code/zcoll.c @@ -1,7 +1,7 @@ /* zcoll.c: Collection test * * $Id$ - * Copyright (c) 2008 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2008-2014 Ravenbrook Limited. See end of file for license. * Portions copyright (C) 2002 Global Graphics Software. * * OBJECTIVE @@ -838,8 +838,7 @@ static void testscriptA(const char *script) */ int main(int argc, char *argv[]) { - randomize(argc, argv); - mps_lib_assert_fail_install(assert_die); + testlib_init(argc, argv); /* 1<<19 == 524288 == 1/2 Mebibyte */ /* 16<<20 == 16777216 == 16 Mebibyte */ @@ -938,7 +937,7 @@ int main(int argc, char *argv[]) /* C. COPYRIGHT AND LICENSE * - * Copyright (c) 2001-2013 Ravenbrook Limited . + * Copyright (c) 2001-2014 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. * diff --git a/mps/code/zmess.c b/mps/code/zmess.c index 0ad57e09c46..1c87ac56cf2 100644 --- a/mps/code/zmess.c +++ b/mps/code/zmess.c @@ -1,7 +1,7 @@ /* zmess.c: Message test * * $Id$ - * Copyright (c) 2008 Ravenbrook Limited. See end of file for license. + * Copyright (c) 2008-2014 Ravenbrook Limited. See end of file for license. * Portions copyright (C) 2002 Global Graphics Software. * * OBJECTIVE @@ -486,9 +486,7 @@ Bool TIMCA_remote(void) */ int main(int argc, char *argv[]) { - - randomize(argc, argv); - mps_lib_assert_fail_install(assert_die); + testlib_init(argc, argv); /* Scripts that should fail (uncomment to show failure is detected) */ /*testscriptA("C.");*/ @@ -571,7 +569,7 @@ int main(int argc, char *argv[]) /* C. COPYRIGHT AND LICENSE * - * Copyright (c) 2001-2013 Ravenbrook Limited . + * Copyright (c) 2001-2014 Ravenbrook Limited . * All rights reserved. This is an open source license. Contact * Ravenbrook for commercial licensing options. *