From 6f3fb8a547f5700416744a7dc82b3cb83177c7a8 Mon Sep 17 00:00:00 2001 From: Chris Johns Date: Tue, 7 Nov 2017 16:43:11 +1100 Subject: cpukit: Add a Version API. Provide functions to get the version string, major, minor and revision numbers and the version control identifer that is a unique tag for the version control system. Update #3199. --- testsuites/sptests/Makefile.am | 1 + testsuites/sptests/configure.ac | 1 + testsuites/sptests/spversion01/Makefile.am | 20 +++++++++ testsuites/sptests/spversion01/init.c | 58 ++++++++++++++++++++++++++ testsuites/sptests/spversion01/spversion01.doc | 24 +++++++++++ testsuites/sptests/spversion01/spversion01.scn | 21 ++++++++++ 6 files changed, 125 insertions(+) create mode 100644 testsuites/sptests/spversion01/Makefile.am create mode 100644 testsuites/sptests/spversion01/init.c create mode 100644 testsuites/sptests/spversion01/spversion01.doc create mode 100644 testsuites/sptests/spversion01/spversion01.scn (limited to 'testsuites/sptests') diff --git a/testsuites/sptests/Makefile.am b/testsuites/sptests/Makefile.am index 843116c139..e52316a825 100644 --- a/testsuites/sptests/Makefile.am +++ b/testsuites/sptests/Makefile.am @@ -82,6 +82,7 @@ _SUBDIRS += sptimer_err01 sptimer_err02 _SUBDIRS += sptimerserver01 _SUBDIRS += spclock_err02 _SUBDIRS += spcpuset01 +_SUBDIRS += spversion01 include $(top_srcdir)/../automake/subdirs.am include $(top_srcdir)/../automake/local.am diff --git a/testsuites/sptests/configure.ac b/testsuites/sptests/configure.ac index aeb97024c7..0872f678f7 100644 --- a/testsuites/sptests/configure.ac +++ b/testsuites/sptests/configure.ac @@ -253,5 +253,6 @@ spcpuset01/Makefile spregion_err01/Makefile sppartition_err01/Makefile sprmsched01/Makefile +spversion01/Makefile ]) AC_OUTPUT diff --git a/testsuites/sptests/spversion01/Makefile.am b/testsuites/sptests/spversion01/Makefile.am new file mode 100644 index 0000000000..0ab6da4756 --- /dev/null +++ b/testsuites/sptests/spversion01/Makefile.am @@ -0,0 +1,20 @@ + +rtems_tests_PROGRAMS = spversion01 +spversion01_SOURCES = init.c + +dist_rtems_tests_DATA = spversion01.scn spversion01.doc + +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am +include $(top_srcdir)/../automake/leaf.am + +AM_CPPFLAGS += -I$(top_srcdir)/../support/include + +LINK_OBJS = $(spversion01_OBJECTS) +LINK_LIBS = $(spversion01_LDLIBS) + +spversion01$(EXEEXT): $(spversion01_OBJECTS) $(spversion01_DEPENDENCIES) + @rm -f spversion01$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/sptests/spversion01/init.c b/testsuites/sptests/spversion01/init.c new file mode 100644 index 0000000000..3fc6f0a89c --- /dev/null +++ b/testsuites/sptests/spversion01/init.c @@ -0,0 +1,58 @@ +/* + * COPYRIGHT (c) 1989-2011. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.org/license/LICENSE. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include + +#include + +const char rtems_test_name[] = "VERSION 1"; + +static rtems_task Init( + rtems_task_argument argument +) +{ + TEST_BEGIN(); + + printf("Release : %s\n", rtems_version()); + printf("Major : %d\n", rtems_version_major()); + printf("Minor : %d\n", rtems_version_minor()); + printf("Revision : %d\n", rtems_version_revision()); + printf("VC Key : %s\n", rtems_version_control_key()); + + TEST_END(); + + rtems_test_exit(0); +} + +/* configuration information */ + +#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION + +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE + +#define CONFIGURE_EXTRA_TASK_STACKS (4 * RTEMS_MINIMUM_STACK_SIZE) +#define CONFIGURE_MAXIMUM_TASKS 2 + +#define CONFIGURE_DISABLE_SMP_CONFIGURATION + +#define CONFIGURE_INIT + +#include + +/* global variables */ + +/* end of include file */ diff --git a/testsuites/sptests/spversion01/spversion01.doc b/testsuites/sptests/spversion01/spversion01.doc new file mode 100644 index 0000000000..c0783a4351 --- /dev/null +++ b/testsuites/sptests/spversion01/spversion01.doc @@ -0,0 +1,24 @@ +# Copyright (C) 2017 +# Chris Johns +# +# The license and distribution terms for this file may be +# found in the file LICENSE in this distribution or at +# http://www.rtems.org/license/LICENSE. +# + +This file describes the directives and concepts tested by this test set. + +test set name: spversion01 + +directives: + + rtems_version - return the RTEMS version string with VC indent if present. + rtems_major - return the RTEMS major version number. + rtems_minor - return the RTEMS minor version number. + rtems_release - return the RTEMS version release number. + rtems_version_control_key - return the RTEMS Version Control (VC) key string. + +concepts: + ++ Ensure the files are correctly generated and the headers can be built and + the API is usable. diff --git a/testsuites/sptests/spversion01/spversion01.scn b/testsuites/sptests/spversion01/spversion01.scn new file mode 100644 index 0000000000..a0f2282510 --- /dev/null +++ b/testsuites/sptests/spversion01/spversion01.scn @@ -0,0 +1,21 @@ +Valid version control: + +*** BEGIN OF TEST VERSION 1 *** +Release : 4.11.99.0.d71542c8bef50261bc3904ef6a17f0b6087d04d9-modified +Major : 4 +Minor : 11 +Revision : 99 +VC Key : d71542c8bef50261bc3904ef6a17f0b6087d04d9-modified + +*** END OF TEST VERSION 1 *** + +No valid version control: + +*** BEGIN OF TEST VERSION 1 *** +Release : 4.11.99.0 +Major : 4 +Minor : 11 +Revision : 99 +VC Key : (null) + +*** END OF TEST VERSION 1 *** -- cgit v1.2.3