summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2019-09-10 09:21:11 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2019-09-11 07:28:34 +0200
commitc1a1f2c8da4993b03f0a8fadac8f0521df48abec (patch)
tree598a1ceae0343d42a31031fc21c79eee53cc02ac
parentAdd psxfenv01 test to psxtests (diff)
downloadrtems-c1a1f2c8da4993b03f0a8fadac8f0521df48abec.tar.bz2
Add rtems_version_control_key_is_valid()
-rw-r--r--cpukit/include/rtems/version.h19
-rw-r--r--testsuites/sptests/spversion01/init.c8
2 files changed, 24 insertions, 3 deletions
diff --git a/cpukit/include/rtems/version.h b/cpukit/include/rtems/version.h
index 30dd70cc21..a8aff732f3 100644
--- a/cpukit/include/rtems/version.h
+++ b/cpukit/include/rtems/version.h
@@ -16,6 +16,8 @@
#ifndef _RTEMS_VERSION_H
#define _RTEMS_VERSION_H
+#include <stdbool.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -65,12 +67,25 @@ int rtems_version_revision( void );
* The key is specific to the version control system being used and allows the
* built version to be identified.
*
- * @return The version control key or the empty string if no version control
- * key is available.
+ * Use rtems_version_control_key_is_valid() to check if the version control key
+ * is valid.
+ *
+ * @return The version control key.
*/
const char *rtems_version_control_key( void );
/**
+ * @brief Returns true, if the version control key is valid, otherwise false.
+ *
+ * @retval true The version control key is valid.
+ * @retval false Otherwise.
+ */
+static inline bool rtems_version_control_key_is_valid( const char *key )
+{
+ return key[ 0 ] != '\0';
+}
+
+/**
* @brief Returns the board support package name.
*
* @return The board support package name.
diff --git a/testsuites/sptests/spversion01/init.c b/testsuites/sptests/spversion01/init.c
index fc38577691..9db3143d39 100644
--- a/testsuites/sptests/spversion01/init.c
+++ b/testsuites/sptests/spversion01/init.c
@@ -22,13 +22,19 @@ static rtems_task Init(
rtems_task_argument argument
)
{
+ const char *key;
+ const char *valid;
+
TEST_BEGIN();
+ key = rtems_version_control_key();
+ valid = rtems_version_control_key_is_valid(key) ? "valid" : "invalid";
+
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());
+ printf("VC Key : %s (%s)\n", key, valid);
printf("BSP : %s\n", rtems_board_support_package());
TEST_END();