# HG changeset patch # User gthomas # Date 1052237402 0 # Node ID b8e01d85e2d440c1b529c2b0b4051f23c5a657a5 # Parent 6204f4b6686d0c750e31c41c6dd8adb5d7d22f1b Add CDL to control number of times 'tests' run. diff --git a/packages/infra/current/ChangeLog b/packages/infra/current/ChangeLog --- a/packages/infra/current/ChangeLog +++ b/packages/infra/current/ChangeLog @@ -1,3 +1,7 @@ +2003-05-05 Gary Thomas + + * cdl/infra.cdl: Add option to control number of times tests run. + 2003-04-25 Jonathan Larmour * tests/cxxsupp.cxx: don't include as it's not diff --git a/packages/infra/current/cdl/infra.cdl b/packages/infra/current/cdl/infra.cdl --- a/packages/infra/current/cdl/infra.cdl +++ b/packages/infra/current/cdl/infra.cdl @@ -301,11 +301,22 @@ cdl_package CYGPKG_INFRA { the set of global flags if present." } - cdl_option CYGPKG_INFRA_TESTS { + cdl_component CYGPKG_INFRA_TESTS { display "Infra package tests" flavor data no_define calculated { "tests/cxxsupp" } + + cdl_option CYGNUM_TESTS_RUN_COUNT { + display "Number of times a test runs" + flavor data + default_value 1 + description " + This option controls the number of times tests will execute their + basic function. Not all tests will honor this setting, but those + that do will execute the test N times before terminating. A value + less than 0 indicates to run forever." + } } } diff --git a/packages/kernel/current/ChangeLog b/packages/kernel/current/ChangeLog --- a/packages/kernel/current/ChangeLog +++ b/packages/kernel/current/ChangeLog @@ -1,3 +1,9 @@ +2003-05-05 Gary Thomas + + * tests/tm_basic.cxx: Support new option controlling number of times + this test runs. This is useful for long-term stress and performance + analysis. + 2003-05-03 Jonathan Larmour * include/mqueue.inl (Cyg_Mqueue::get): Fix invalid loop termination diff --git a/packages/kernel/current/tests/tm_basic.cxx b/packages/kernel/current/tests/tm_basic.cxx --- a/packages/kernel/current/tests/tm_basic.cxx +++ b/packages/kernel/current/tests/tm_basic.cxx @@ -9,7 +9,7 @@ // ------------------------------------------- // This file is part of eCos, the Embedded Configurable Operating System. // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. -// Copyright (C) 2002 Gary Thomas +// Copyright (C) 2002, 2003 Gary Thomas // // eCos is free software; you can redistribute it and/or modify it under // the terms of the GNU General Public License as published by the Free @@ -1635,8 +1635,8 @@ run_sched_tests(void) end_of_test_group(); } -void -run_all_tests(CYG_ADDRESS id) +static void +_run_all_tests(CYG_ADDRESS id) { int i, j; cyg_uint32 tv[nsamples], tv0, tv1; @@ -1780,7 +1780,18 @@ run_all_tests(CYG_ADDRESS id) ticks = cyg_current_time(); diag_printf("\nTiming complete - %d ms total\n\n", (int)((ticks*ns_per_system_clock)/1000)); +} +void +run_all_tests(CYG_ADDRESS id) +{ +#if CYGNUM_TESTS_RUN_COUNT < 0 + while (1) +#else + int i; + for (i = 0; i < CYGNUM_TESTS_RUN_COUNT; i++) +#endif + _run_all_tests(id); CYG_TEST_PASS_FINISH("Basic timing OK"); }