summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank Kühndel <frank.kuehndel@embedded-brains.de>2021-09-21 09:58:20 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2021-09-24 13:23:42 +0200
commitb22a800ab5e16c29d04bb788fa4a2bde1a59fc24 (patch)
tree0055bbfe63f7d94d0617a60826fb8ff2b0fdebc1
parentspec: Unit tests Messge Queue Handler (diff)
downloadrtems-central-b22a800ab5e16c29d04bb788fa4a2bde1a59fc24.tar.bz2
spec: add unit tests for kern_tc.c
Parts of the file ``cpukit/score/src/kern_tc.c`` are only executed by the POSIX API and certain device driver code. The space qualified code subset does not contain those features. This test exercises the code parts otherwise not reached in order to achieve full code coverage.
-rw-r--r--spec/score/timecounter/unit/kern-tc.yml196
1 files changed, 196 insertions, 0 deletions
diff --git a/spec/score/timecounter/unit/kern-tc.yml b/spec/score/timecounter/unit/kern-tc.yml
new file mode 100644
index 00000000..0ec6d955
--- /dev/null
+++ b/spec/score/timecounter/unit/kern-tc.yml
@@ -0,0 +1,196 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links: []
+test-actions:
+
+#### _Timecounter_Getbintime() ################################################
+
+- action-brief: |
+ Call function _Timecounter_Getbintime().
+ action-code: |
+ struct bintime bt;
+ _Timecounter_Getbintime( &bt );
+ checks:
+ - brief: |
+ Check value returned by function call.
+ code: |
+ T_eq_u64( bt.sec, TOD_SECONDS_1970_THROUGH_1988 );
+ T_eq_long( bt.frac, 0 );
+ links: []
+ links:
+ - name: _Timecounter_Getbintime
+ role: unit-test
+ uid: ../../if/domain
+
+#### _Timecounter_Getbinuptime() ##############################################
+
+- action-brief: |
+ Call function _Timecounter_Getbinuptime().
+ action-code: |
+ struct bintime bt;
+ _Timecounter_Getbinuptime( &bt );
+ checks:
+ - brief: |
+ Check value returned by function call.
+ code: |
+ T_eq_u64( bt.sec, 1 );
+ T_eq_long( bt.frac, 0 );
+ links: []
+ links:
+ - name: _Timecounter_Getbinuptime
+ role: unit-test
+ uid: ../../if/domain
+
+#### _Timecounter_Getboottime() ##############$$$##############################
+
+- action-brief: |
+ Call function _Timecounter_Getboottime().
+ action-code: |
+ struct timeval tv;
+ _Timecounter_Getboottime( &tv );
+ checks:
+ - brief: |
+ Check value returned by function call.
+ code: |
+ T_eq_u64( tv.tv_sec, TOD_SECONDS_1970_THROUGH_1988 - 1 );
+ T_eq_long( tv.tv_usec, 0 );
+ links: []
+ links:
+ - name: _Timecounter_Getboottime
+ role: unit-test
+ uid: ../../if/domain
+
+#### _Timecounter_Getboottimebin() ############################################
+
+- action-brief: |
+ Call function _Timecounter_Getboottimebin().
+ action-code: |
+ struct bintime bt;
+ _Timecounter_Getboottimebin( &bt );
+ checks:
+ - brief: |
+ Check value returned by function call.
+ code: |
+ T_eq_u64( bt.sec, TOD_SECONDS_1970_THROUGH_1988 - 1 );
+ T_eq_long( bt.frac, 0 );
+ links: []
+ links:
+ - name: _Timecounter_Getboottimebin
+ role: unit-test
+ uid: ../../if/domain
+
+#### _Timecounter_Getmicrotime() ##############################################
+
+- action-brief: |
+ Call function _Timecounter_Getmicrotime().
+ action-code: |
+ struct timeval tv;
+ _Timecounter_Getmicrotime( &tv );
+ checks:
+ - brief: |
+ Check value returned by function call.
+ code: |
+ T_eq_u64( tv.tv_sec, TOD_SECONDS_1970_THROUGH_1988 );
+ T_eq_long( tv.tv_usec, 0 );
+ links: []
+ links:
+ - name: _Timecounter_Getmicrotime
+ role: unit-test
+ uid: ../../if/domain
+
+#### _Timecounter_Getmicrouptime() ############################################
+
+- action-brief: |
+ Call function _Timecounter_Getmicrouptime().
+ action-code: |
+ struct timeval tv;
+ _Timecounter_Getmicrouptime( &tv );
+ checks:
+ - brief: |
+ Check value returned by function call.
+ code: |
+ T_eq_u64( tv.tv_sec, 1 );
+ T_eq_long( tv.tv_usec, 0 );
+ links: []
+ links:
+ - name: _Timecounter_Getmicrouptime
+ role: unit-test
+ uid: ../../if/domain
+
+#### _Timecounter_Microuptime() ##############################################
+
+- action-brief: |
+ Call function _Timecounter_Microuptime().
+ action-code: |
+ struct timeval tv;
+ _Timecounter_Microuptime( &tv );
+ checks:
+ - brief: |
+ Check value returned by function call.
+ code: |
+ T_eq_u64( tv.tv_sec, 1 );
+ T_eq_long( tv.tv_usec, 0 );
+ links: []
+ links:
+ - name: _Timecounter_Microuptime
+ role: unit-test
+ uid: ../../if/domain
+
+#### _Timecounter_Nanotime() #################################################
+
+- action-brief: |
+ Call function _Timecounter_Nanotime().
+ action-code: |
+ struct timespec ts;
+ _Timecounter_Nanotime( &ts );
+ checks:
+ - brief: |
+ Check value returned by function call.
+ code: |
+ T_eq_u64( ts.tv_sec, TOD_SECONDS_1970_THROUGH_1988 );
+ T_eq_long( ts.tv_nsec, 0 );
+ links: []
+ links:
+ - name: _Timecounter_Nanotime
+ role: unit-test
+ uid: ../../if/domain
+
+#### _Timecounter_Tick_simple() ###############################################
+
+- action-brief: |
+ Call function _Timecounter_Tick_simple().
+ action-code: |
+ ISR_lock_Context lock_context;
+ _Timecounter_Acquire( &lock_context );
+ _Timecounter_Tick_simple( 0, 0, &lock_context );
+ checks: []
+ links:
+ - name: _Timecounter_Tick_simple
+ role: unit-test
+ uid: ../../if/domain
+
+###############################################################################
+
+test-brief: |
+ Unit tests for the time counter kern_tc part.
+test-context: []
+test-context-support: null
+test-description: |
+ Parts of the file ``cpukit/score/src/kern_tc.c``
+ are only executed by the POSIX API and certain device driver code. The
+ space qualified code subset does not contain those features. This test
+ exercises the code parts otherwise not reached in order to achieve full
+ code coverage.
+test-header: null
+test-includes:
+- rtems/score/timecounter.h
+- rtems/score/todimpl.h
+test-local-includes: []
+test-setup: null
+test-stop: null
+test-support: null
+test-target: testsuites/unit/tc-score-kern-tc.c
+test-teardown: null
+type: test-case