Changeset 9f9917c in rtems-central


Ignore:
Timestamp:
11/24/21 15:08:52 (2 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
2647229
Parents:
c0d8670
git-author:
Sebastian Huber <sebastian.huber@…> (11/24/21 15:08:52)
git-committer:
Sebastian Huber <sebastian.huber@…> (11/25/21 06:43:59)
Message:

validation: Support optional perf measurements

Location:
rtemsspec
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • rtemsspec/tests/test_validation.py

    rc0d8670 r9f9917c  
    11851185}
    11861186
     1187#if defined(FOOBAR)
     1188/**
     1189 * @brief Body brief.
     1190 *
     1191 * Body description.
     1192 */
     1193static void Rpr2_Body( Rtm_Context *ctx )
     1194{
     1195  /* Body code */
     1196}
     1197
     1198static void Rpr2_Body_Wrap( void *arg )
     1199{
     1200  Rtm_Context *ctx;
     1201
     1202  ctx = arg;
     1203  Rpr2_Body( ctx );
     1204}
     1205#endif
     1206
    11871207/**
    11881208 * @fn void T_case_body_Rtm( void )
     
    12011221  Rpr_Cleanup( ctx );
    12021222  Rtm_Cleanup( ctx );
     1223
     1224  #if defined(FOOBAR)
     1225  ctx->request.name = "Rpr2";
     1226  ctx->request.setup = NULL;
     1227  ctx->request.body = Rpr2_Body_Wrap;
     1228  ctx->request.teardown = NULL;
     1229  T_measure_runtime( ctx->context, &ctx->request );
     1230  Rtm_Cleanup( ctx );
     1231  #endif
    12031232}
    12041233
  • rtemsspec/validation.py

    rc0d8670 r9f9917c  
    3333from typing import Any, Dict, List, Optional, Tuple
    3434
    35 from rtemsspec.content import CContent, CInclude, \
    36     GenericContent, get_integer_type, get_value_params, get_value_plural, \
    37     get_value_doxygen_group, get_value_doxygen_function, to_camel_case
     35from rtemsspec.content import CContent, CInclude, enabled_by_to_exp, \
     36    ExpressionMapper, GenericContent, get_integer_type, get_value_params, \
     37    get_value_plural, get_value_doxygen_group, get_value_doxygen_function, \
     38    to_camel_case
    3839from rtemsspec.items import Item, ItemCache, \
    3940    ItemGetValueContext, ItemMapper
     
    922923            req = _RuntimeMeasurementRequestItem(item, self.context)
    923924            requests.add_blank_line()
     925            enabled_by = item["enabled-by"]
     926            use_enabled_by = not isinstance(enabled_by, bool) or not enabled_by
     927            if use_enabled_by:
     928                exp = enabled_by_to_exp(enabled_by, ExpressionMapper())
     929                if_exp = f"#if {exp}"
     930                requests.add(if_exp)
     931                content.add(if_exp)
     932                content.gap = False
    924933            _add_call_method(requests, prepare)
    925934            name = req.add_support_method(content,
     
    956965            _add_call_method(requests, name)
    957966            _add_call_method(requests, cleanup)
     967            if use_enabled_by:
     968                requests.append("#endif")
     969                content.append("#endif")
    958970        return requests
    959971
Note: See TracChangeset for help on using the changeset viewer.