This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.
Pablo Neira Ayuso pablo at gnumonks.orgHolger likes having a parameter to set the number of steps in this test. Now you can set it via `-s' option. Signed-off-by: Pablo Neira Ayuso <pablo at gnumonks.org> --- tests/timer/timer_test.c | 25 ++++++++++++++++++++++--- 1 files changed, 22 insertions(+), 3 deletions(-) diff --git a/tests/timer/timer_test.c b/tests/timer/timer_test.c index bcaafdb..a01a9e5 100644 --- a/tests/timer/timer_test.c +++ b/tests/timer/timer_test.c @@ -24,6 +24,7 @@ #include <stdio.h> #include <stdlib.h> +#include <getopt.h> #include <osmocom/core/talloc.h> #include <osmocom/core/timer.h> @@ -60,6 +61,7 @@ struct test_timer { #define TIMER_PRES_SECS 0 #define TIMER_PRES_USECS 10000 +static int timer_nsteps = MAIN_TIMER_NSTEPS; static unsigned int expired_timers = 0; static unsigned int total_timers = 0; static unsigned int too_late = 0; @@ -70,7 +72,7 @@ static void main_timer_fired(void *data) unsigned int add_in_this_step; int i; - if (*step == MAIN_TIMER_NSTEPS) { + if (*step == timer_nsteps) { printf("Main timer has finished, please, wait a bit for the " "final report.\n"); return; @@ -134,11 +136,28 @@ static void secondary_timer_fired(void *data) } } -int main(int argc, char** argv) +int main(int argc, char *argv[]) { + int c; + + while ((c = getopt_long(argc, argv, "s:", NULL, NULL)) != -1) { + switch(c) { + case 's': + timer_nsteps = atoi(optarg); + if (timer_nsteps <= 0) { + fprintf(stderr, "%s: steps must be > 0\n", + argv[0]); + exit(EXIT_FAILURE); + } + break; + default: + exit(EXIT_FAILURE); + } + } + printf("Running timer test for %u steps, accepting imprecision " "of %u.%.6u seconds\n", - MAIN_TIMER_NSTEPS, TIMER_PRES_SECS, TIMER_PRES_USECS); + timer_nsteps, TIMER_PRES_SECS, TIMER_PRES_USECS); osmo_timer_schedule(&main_timer, 1, 0); -- 1.7.2.5 --k1lZvvs/B4yU6o8G--