From 77ac1519e863b7095f69c976353f7647c6f6f63b Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 20 Dec 2019 10:55:36 +0100 Subject: libtest: Use test configuration in T_now() Use the user provided now handler of the test configuration to get the time in T_now(). --- testsuites/libtests/ttest01/init.c | 29 ++--------------------------- testsuites/libtests/ttest01/test-time.c | 8 ++++---- 2 files changed, 6 insertions(+), 31 deletions(-) (limited to 'testsuites/libtests') diff --git a/testsuites/libtests/ttest01/init.c b/testsuites/libtests/ttest01/init.c index b3ebfb5b73..31b57cf6f9 100644 --- a/testsuites/libtests/ttest01/init.c +++ b/testsuites/libtests/ttest01/init.c @@ -32,8 +32,6 @@ #include #include -#include -#include #include "t-self-test.h" @@ -54,7 +52,6 @@ typedef struct { const char *c; size_t case_begin_count; size_t case_end_count; - struct timecounter tc; T_putchar putchar; void *putchar_arg; const char *censor_c; @@ -180,8 +177,8 @@ run_initialize(void) T_set_putchar(censor_putchar, ctx, &ctx->putchar, &ctx->putchar_arg); } -static const char expected_final[] = "Z:ttest01:C:341:N:1316:F:790:D:0.682999\n" -"Y:ReportHash:SHA256:62d6f3b37299137932ea2c2f0505c8b8f12b95749c81d5af19570e9470203475\n"; +static const char expected_final[] = "Z:ttest01:C:341:N:1316:F:790:D:0.685999\n" +"Y:ReportHash:SHA256:cb5ba027ade5b907d9e988776e393835f34a76cc2381d67bb9db44d986a3fecf\n"; static void run_finalize(void) @@ -226,28 +223,6 @@ now(void) return t * SBT_1MS; } -static uint32_t -get_timecount(struct timecounter *tc) -{ - return 0; -} - -static void -install_timecounter(void) -{ - test_context *ctx; - - ctx = &test_instance; - ctx->tc.tc_get_timecount = get_timecount; - ctx->tc.tc_counter_mask = 0xffffffff; - ctx->tc.tc_frequency = 1000000000; - ctx->tc.tc_quality = RTEMS_TIMECOUNTER_QUALITY_CLOCK_DRIVER + 1; - rtems_timecounter_install(&ctx->tc); -} - -RTEMS_SYSINIT_ITEM(install_timecounter, RTEMS_SYSINIT_DEVICE_DRIVERS, - RTEMS_SYSINIT_ORDER_FIRST); - static char buffer[512]; static const T_action actions[] = { diff --git a/testsuites/libtests/ttest01/test-time.c b/testsuites/libtests/ttest01/test-time.c index 01e6516cf2..20148d7ea1 100644 --- a/testsuites/libtests/ttest01/test-time.c +++ b/testsuites/libtests/ttest01/test-time.c @@ -203,8 +203,8 @@ T_TEST_OUTPUT(time_to_string, T_TEST_OUTPUT(now, "B:now\n" -"L:0.000000000\n" -"E:now:N:0:F:0:D:0.001000\n"); +"L:0.001000000\n" +"E:now:N:0:F:0:D:0.003000\n"); T_TEST_OUTPUT(tick, "B:tick\n" @@ -268,8 +268,8 @@ T_TEST_OUTPUT(ticks, T_TEST_OUTPUT(begin_time, "B:begin_time\n" -"L:time at test case begin 0.325000046\n" -"E:begin_time:N:0:F:0:D:0.001000\n"); +"L:time at test case begin 0.001000000\n" +"E:begin_time:N:0:F:0:D:0.002000\n"); /* * The license is at the end of the file to be able to use the test code and -- cgit v1.2.3