From 976f208ff2247f9801dec4371327282edf2d5e98 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 19 May 2023 08:06:01 +0200 Subject: validation: Add checks to static assert tests This ensures that the test cases have at least one test step. Update #3716. --- testsuites/validation/tc-scheduler-non-smp.c | 39 ++++++++++++++++++++++------ testsuites/validation/tc-status.c | 24 +++++++++++++---- 2 files changed, 50 insertions(+), 13 deletions(-) (limited to 'testsuites') diff --git a/testsuites/validation/tc-scheduler-non-smp.c b/testsuites/validation/tc-scheduler-non-smp.c index d0353ebca0..7503c6880a 100644 --- a/testsuites/validation/tc-scheduler-non-smp.c +++ b/testsuites/validation/tc-scheduler-non-smp.c @@ -7,7 +7,7 @@ */ /* - * Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) + * Copyright (C) 2021, 2023 embedded brains GmbH (http://www.embedded-brains.de) * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -66,18 +66,22 @@ * * This test case performs the following actions: * - * - Check that calling rtems_scheduler_get_processor() is a constant - * expression which evaluates to zero. + * - Assert that rtems_scheduler_get_processor() is a constant expression which + * evaluates to zero. + * + * - Check that calling rtems_scheduler_get_processor() returns zero. * - * - Check that calling rtems_scheduler_get_processor_maximum() is a constant + * - Assert that rtems_scheduler_get_processor_maximum() is a constant * expression which evaluates to zero. * + * - Check that calling rtems_scheduler_get_processor_maximum() returns one. + * * @{ */ /** - * @brief Check that calling rtems_scheduler_get_processor() is a constant - * expression which evaluates to zero. + * @brief Assert that rtems_scheduler_get_processor() is a constant expression + * which evaluates to zero. */ static void RtemsSchedulerValNonSmp_Action_0( void ) { @@ -85,10 +89,18 @@ static void RtemsSchedulerValNonSmp_Action_0( void ) } /** - * @brief Check that calling rtems_scheduler_get_processor_maximum() is a - * constant expression which evaluates to zero. + * @brief Check that calling rtems_scheduler_get_processor() returns zero. */ static void RtemsSchedulerValNonSmp_Action_1( void ) +{ + T_eq_u32( rtems_scheduler_get_processor(), 0 ); +} + +/** + * @brief Assert that rtems_scheduler_get_processor_maximum() is a constant + * expression which evaluates to zero. + */ +static void RtemsSchedulerValNonSmp_Action_2( void ) { RTEMS_STATIC_ASSERT( rtems_scheduler_get_processor_maximum() == 1, @@ -96,6 +108,15 @@ static void RtemsSchedulerValNonSmp_Action_1( void ) ); } +/** + * @brief Check that calling rtems_scheduler_get_processor_maximum() returns + * one. + */ +static void RtemsSchedulerValNonSmp_Action_3( void ) +{ + T_eq_u32( rtems_scheduler_get_processor_maximum(), 1 ); +} + /** * @fn void T_case_body_RtemsSchedulerValNonSmp( void ) */ @@ -103,6 +124,8 @@ T_TEST_CASE( RtemsSchedulerValNonSmp ) { RtemsSchedulerValNonSmp_Action_0(); RtemsSchedulerValNonSmp_Action_1(); + RtemsSchedulerValNonSmp_Action_2(); + RtemsSchedulerValNonSmp_Action_3(); } /** @} */ diff --git a/testsuites/validation/tc-status.c b/testsuites/validation/tc-status.c index be706fa86f..3ac13f1253 100644 --- a/testsuites/validation/tc-status.c +++ b/testsuites/validation/tc-status.c @@ -7,7 +7,7 @@ */ /* - * Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) + * Copyright (C) 2021, 2023 embedded brains GmbH (http://www.embedded-brains.de) * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -67,12 +67,16 @@ * * - Validate the status code constants. * - * - Check that RTEMS_STATUS_CODES_FIRST has the expected value and is a + * - Assert that RTEMS_STATUS_CODES_FIRST has the expected value and is a * constant expression. * - * - Check that RTEMS_STATUS_CODES_LAST has the expected value and is a + * - Check that RTEMS_STATUS_CODES_FIRST has the expected value. + * + * - Assert that RTEMS_STATUS_CODES_LAST has the expected value and is a * constant expression. * + * - Check that RTEMS_STATUS_CODES_LAST has the expected value. + * * @{ */ @@ -84,16 +88,26 @@ static void RtemsStatusValStatus_Action_0( void ) /* Nothing to do */ /* - * Check that RTEMS_STATUS_CODES_FIRST has the expected value and is a + * Assert that RTEMS_STATUS_CODES_FIRST has the expected value and is a * constant expression. */ RTEMS_STATIC_ASSERT( RTEMS_STATUS_CODES_FIRST == 0, FIRST ); /* - * Check that RTEMS_STATUS_CODES_LAST has the expected value and is a + * Check that RTEMS_STATUS_CODES_FIRST has the expected value. + */ + T_eq_int( RTEMS_STATUS_CODES_FIRST, 0 ); + + /* + * Assert that RTEMS_STATUS_CODES_LAST has the expected value and is a * constant expression. */ RTEMS_STATIC_ASSERT( RTEMS_STATUS_CODES_LAST == 29, LAST ); + + /* + * Check that RTEMS_STATUS_CODES_LAST has the expected value. + */ + T_eq_int( RTEMS_STATUS_CODES_LAST, 29 ); } /** -- cgit v1.2.3