changeset 1001:b8e01d85e2d4

Add CDL to control number of times 'tests' run.
author gthomas
date Tue, 06 May 2003 16:10:02 +0000
parents 6204f4b6686d
children 609c8b1447ee
files packages/infra/current/ChangeLog packages/infra/current/cdl/infra.cdl packages/kernel/current/ChangeLog packages/kernel/current/tests/tm_basic.cxx
diffstat 4 files changed, 36 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/packages/infra/current/ChangeLog
+++ b/packages/infra/current/ChangeLog
@@ -1,3 +1,7 @@
+2003-05-05  Gary Thomas  <gary@mlbassoc.com>
+
+	* cdl/infra.cdl: Add option to control number of times tests run.
+
 2003-04-25  Jonathan Larmour  <jifl@eCosCentric.com>
 
 	* tests/cxxsupp.cxx: don't include <pkgconf/kernel.h> as it's not
--- 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."
+            }
         }
 
     }
--- a/packages/kernel/current/ChangeLog
+++ b/packages/kernel/current/ChangeLog
@@ -1,3 +1,9 @@
+2003-05-05  Gary Thomas  <gary@mlbassoc.com>
+
+	* 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  <jifl@eCosCentric.com>
 
 	* include/mqueue.inl (Cyg_Mqueue::get): Fix invalid loop termination
--- 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");
 }