[rtems commit] spcpuset01: Add check for sys/cpuset.h.

Jennifer Averett jennifer at rtems.org
Fri Mar 7 15:08:50 UTC 2014


Module:    rtems
Branch:    master
Commit:    13ab94be6ce3130c55ebb57fa96406d6b6e8c2b8
Changeset: http://git.rtems.org/rtems/commit/?id=13ab94be6ce3130c55ebb57fa96406d6b6e8c2b8

Author:    Jennifer Averett <jennifer.averett at oarcorp.com>
Date:      Thu Feb  6 12:51:01 2014 -0600

spcpuset01: Add check for sys/cpuset.h.

If <sys/cpuset.h> is not provided by the toolset, the test
cannot be compiled.

---

 testsuites/sptests/spcpuset01/init.c   |   16 ++++++++++++++--
 testsuites/sptests/spcpuset01/system.h |   14 +++++++++-----
 testsuites/sptests/spcpuset01/test.c   |    9 ++++++---
 3 files changed, 29 insertions(+), 10 deletions(-)

diff --git a/testsuites/sptests/spcpuset01/init.c b/testsuites/sptests/spcpuset01/init.c
index fa0e6a8..138438f 100644
--- a/testsuites/sptests/spcpuset01/init.c
+++ b/testsuites/sptests/spcpuset01/init.c
@@ -11,10 +11,10 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <assert.h>
-
-#include <sys/cpuset.h>
 #include "system.h"
 
+
+#if defined(__RTEMS_HAVE_SYS_CPUSET_H__)
 static void test_cpu_zero_case_1(void)
 {
   size_t i;
@@ -153,3 +153,15 @@ rtems_task Init(
   puts( "*** END OF CPUSET01 Test ***" );
   exit( 0 );
 }
+#else
+#error "Init - No cpuset"
+rtems_task Init(
+  rtems_task_argument ignored
+)
+{
+  puts( "*** CPUSET01 Test ***" );
+  puts( "  cpuset not supported\n" );
+  puts( "*** END OF CPUSET01 Test ***" );
+  exit( 0 );
+}
+#endif
diff --git a/testsuites/sptests/spcpuset01/system.h b/testsuites/sptests/spcpuset01/system.h
index cc3359f..0019abd 100644
--- a/testsuites/sptests/spcpuset01/system.h
+++ b/testsuites/sptests/spcpuset01/system.h
@@ -9,18 +9,22 @@
 
 #include "tmacros.h"
 #include "test_support.h"
-#include <sys/cpuset.h>
 
-/* functions */
+#if defined(__RTEMS_HAVE_SYS_CPUSET_H__)
 
-rtems_task Init(
-  rtems_task_argument argument
-);
+#include <sys/cpuset.h>
 
 /* global variables */
 extern cpu_set_t set1;
 extern cpu_set_t set2;
 extern cpu_set_t set3;
+#endif
+
+/* functions */
+
+rtems_task Init(
+  rtems_task_argument argument
+);
 
 void cpuset_logic_test(void);
 
diff --git a/testsuites/sptests/spcpuset01/test.c b/testsuites/sptests/spcpuset01/test.c
index 3a595e3..2691aff 100644
--- a/testsuites/sptests/spcpuset01/test.c
+++ b/testsuites/sptests/spcpuset01/test.c
@@ -1,3 +1,7 @@
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 /*
  *  Fully exercise CPU_SET() methods
  */
@@ -6,10 +10,9 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <assert.h>
-#include <sys/cpuset.h>
 #include "system.h"
 
-
+#if defined(__RTEMS_HAVE_SYS_CPUSET_H__)
 void test_cpu_and_case_1(size_t cpu1, size_t cpu2);
 void test_cpu_nand_case_1(size_t cpu1, size_t cpu2);
 void test_cpu_or_case_1(size_t cpu1, size_t cpu2);
@@ -122,4 +125,4 @@ void cpuset_logic_test()
     }
   }
 }
-
+#endif




More information about the vc mailing list