[PATCH] psxstrsignal01: New test

Joel Sherrill joel at rtems.org
Wed Mar 15 18:00:00 UTC 2017


---
 testsuites/psxtests/Makefile.am                    |   2 +-
 testsuites/psxtests/configure.ac                   |   1 +
 testsuites/psxtests/psxstrsignal01/Makefile.am     |  24 +++++
 testsuites/psxtests/psxstrsignal01/init.c          | 115 +++++++++++++++++++++
 .../psxtests/psxstrsignal01/psxstrsignal01.doc     |  19 ++++
 .../psxtests/psxstrsignal01/psxstrsignal01.scn     |  38 +++++++
 6 files changed, 198 insertions(+), 1 deletion(-)
 create mode 100644 testsuites/psxtests/psxstrsignal01/Makefile.am
 create mode 100644 testsuites/psxtests/psxstrsignal01/init.c
 create mode 100644 testsuites/psxtests/psxstrsignal01/psxstrsignal01.doc
 create mode 100644 testsuites/psxtests/psxstrsignal01/psxstrsignal01.scn

diff --git a/testsuites/psxtests/Makefile.am b/testsuites/psxtests/Makefile.am
index 2bea8ab..a00aea4 100644
--- a/testsuites/psxtests/Makefile.am
+++ b/testsuites/psxtests/Makefile.am
@@ -12,7 +12,7 @@ _SUBDIRS += psxhdrs psx01 psx02 psx03 psx04 psx05 psx06 psx07 psx08 psx09 \
     psxitimer psxmsgq01 psxmsgq02 psxmsgq03 psxmsgq04 \
     psxmutexattr01 psxobj01 psxrwlock01 psxsem01 psxshm01 psxshm02 \
     psxsignal01 psxsignal02 psxsignal03 psxsignal04 psxsignal05 psxsignal06 \
-    psxspin01 psxsysconf \
+    psxspin01 psxstrsignal01 psxsysconf \
     psxtime psxtimer01 psxtimer02 psxualarm psxusleep psxfatal01 psxfatal02 \
     psxintrcritical01 psxstack01 psxstack02 \
     psxeintr_join psxgetattrnp01 psxclock01
diff --git a/testsuites/psxtests/configure.ac b/testsuites/psxtests/configure.ac
index 77af14e..3211a8d 100644
--- a/testsuites/psxtests/configure.ac
+++ b/testsuites/psxtests/configure.ac
@@ -200,6 +200,7 @@ psxspin01/Makefile
 psxstack01/Makefile
 psxstack02/Makefile
 psxstat/Makefile
+psxstrsignal01/Makefile
 psxsysconf/Makefile
 psxtime/Makefile
 psxtimer01/Makefile
diff --git a/testsuites/psxtests/psxstrsignal01/Makefile.am b/testsuites/psxtests/psxstrsignal01/Makefile.am
new file mode 100644
index 0000000..f353999
--- /dev/null
+++ b/testsuites/psxtests/psxstrsignal01/Makefile.am
@@ -0,0 +1,24 @@
+
+rtems_tests_PROGRAMS = psxstrsignal01
+psxstrsignal01_SOURCES = init.c ../include/pmacros.h
+
+dist_rtems_tests_DATA = psxstrsignal01.scn
+dist_rtems_tests_DATA += psxstrsignal01.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP at .cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+
+AM_CPPFLAGS += -I$(top_srcdir)/include
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+
+LINK_OBJS = $(psxstrsignal01_OBJECTS)
+LINK_LIBS = $(psxstrsignal01_LDLIBS)
+
+psxstrsignal01$(EXEEXT): $(psxstrsignal01_OBJECTS) \
+    $(psxstrsignal01_DEPENDENCIES)
+	@rm -f psxstrsignal01$(EXEEXT)
+	$(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/psxtests/psxstrsignal01/init.c b/testsuites/psxtests/psxstrsignal01/init.c
new file mode 100644
index 0000000..82b517f
--- /dev/null
+++ b/testsuites/psxtests/psxstrsignal01/init.c
@@ -0,0 +1,115 @@
+/*
+ *  COPYRIGHT (c) 2017.
+ *  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 "tmacros.h"
+#include <signal.h>
+#include <string.h>
+#include <stdio.h>
+
+const char rtems_test_name[] = "PSXSTRSIGNAL 1";
+typedef struct {
+  char *sigstr;
+  int   signal;
+} Signals_t;
+
+Signals_t Signals[] = {
+  { "SIGHUP",   SIGHUP },
+  { "SIGINT",   SIGINT },
+  { "SIGQUIT",  SIGQUIT },
+  { "SIGILL",   SIGILL },
+  { "SIGTRAP",  SIGTRAP },
+  { "SIGIOT",   SIGIOT },
+  { "SIGABRT",  SIGABRT },
+#ifdef SIGEMT
+  { "SIGEMT",   SIGEMT },
+#endif
+  { "SIGFPE",   SIGFPE },
+  { "SIGKILL",  SIGKILL },
+  { "SIGBUS",   SIGBUS },
+  { "SIGSEGV",  SIGSEGV },
+  { "SIGSYS",   SIGSYS },
+  { "SIGPIPE",  SIGPIPE },
+  { "SIGALRM",  SIGALRM },
+  { "SIGTERM",  SIGTERM },
+  { "SIGURG",   SIGURG },
+  { "SIGSTOP",  SIGSTOP },
+  { "SIGTSTP",  SIGTSTP },
+  { "SIGCONT",  SIGCONT },
+  { "SIGCHLD",  SIGCHLD },
+  { "SIGCLD",   SIGCLD },
+  { "SIGTTIN",  SIGTTIN },
+  { "SIGTTOU",  SIGTTOU },
+  { "SIGIO",    SIGIO },
+  { "SIGPOLL",  SIGPOLL },
+  { "SIGWINCH", SIGWINCH },
+  { "SIGUSR1",  SIGUSR1 },
+  { "SIGUSR2",  SIGUSR2 },
+  { NULL,       -1 },
+};
+
+void do_test(void)
+{
+  int i;
+
+  puts( "=== Normal Signals" );
+  for (i=0 ; Signals[i].sigstr ; i++) {
+    printf(
+      "signal=%s => %s\n",
+      Signals[i].sigstr,
+      strsignal(Signals[i].signal)
+    );
+  }
+}
+
+void do_test_rt(void)
+{
+  int sig;
+
+  puts( "=== Real-Time Signals" );
+  for (sig=SIGRTMIN ; sig <= SIGRTMAX ; sig++) {
+    printf(
+      "signal=SIGRTMIN+%d => %s\n",
+      sig-SIGRTMIN,
+      strsignal(sig)
+    );
+  }
+}
+
+void *POSIX_Init(
+  void *unused
+)
+{
+  TEST_BEGIN();
+
+  do_test();
+  puts("");
+  do_test_rt();
+
+  TEST_END();
+  rtems_test_exit( 0 );
+
+  return NULL; /* just so the compiler thinks we returned something */
+}
+
+/* configuration information */
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
+
+#define CONFIGURE_MAXIMUM_POSIX_THREADS 1
+
+#define CONFIGURE_POSIX_INIT_THREAD_TABLE
+
+#define CONFIGURE_INIT
+#include <rtems/confdefs.h>
diff --git a/testsuites/psxtests/psxstrsignal01/psxstrsignal01.doc b/testsuites/psxtests/psxstrsignal01/psxstrsignal01.doc
new file mode 100644
index 0000000..43b362d
--- /dev/null
+++ b/testsuites/psxtests/psxstrsignal01/psxstrsignal01.doc
@@ -0,0 +1,19 @@
+#  COPYRIGHT (c) 2017.
+#  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.
+#
+
+This file describes the directives and concepts tested by this test set.
+
+test set name:  psxstrsignal01
+
+directives:
+
+  strsignal
+ 
+concepts:
+
++ Verify that all defined signals correspond to an appropriate string.
diff --git a/testsuites/psxtests/psxstrsignal01/psxstrsignal01.scn b/testsuites/psxtests/psxstrsignal01/psxstrsignal01.scn
new file mode 100644
index 0000000..969f9f0
--- /dev/null
+++ b/testsuites/psxtests/psxstrsignal01/psxstrsignal01.scn
@@ -0,0 +1,38 @@
+** BEGIN OF TEST PSXSTRSIGNAL 1 ***
+=== Normal Signals
+signal=SIGHUP => Hangup
+signal=SIGINT => Interrupt
+signal=SIGQUIT => Quit
+signal=SIGILL => Illegal instruction
+signal=SIGTRAP => Trace/breakpoint trap
+signal=SIGIOT => Aborted
+signal=SIGABRT => Aborted
+signal=SIGFPE => Floating point exception
+signal=SIGKILL => Killed
+signal=SIGBUS => Bus error
+signal=SIGSEGV => Segmentation fault
+signal=SIGSYS => Bad system call
+signal=SIGPIPE => Broken pipe
+signal=SIGALRM => Alarm clock
+signal=SIGTERM => Terminated
+signal=SIGURG => Urgent I/O condition
+signal=SIGSTOP => Stopped (signal)
+signal=SIGTSTP => Stopped
+signal=SIGCONT => Continued
+signal=SIGCHLD => Child exited
+signal=SIGCLD => Child exited
+signal=SIGTTIN => Stopped (tty input)
+signal=SIGTTOU => Stopped (tty output)
+signal=SIGIO => I/O possible
+signal=SIGPOLL => I/O possible
+signal=SIGWINCH => Window changed
+signal=SIGUSR1 => User defined signal 1
+signal=SIGUSR2 => User defined signal 2
+
+=== Real-Time Signals
+signal=SIGRTMIN+0 => Real-time signal 0
+signal=SIGRTMIN+1 => Real-time signal 1
+signal=SIGRTMIN+2 => Real-time signal 2
+signal=SIGRTMIN+3 => Real-time signal 3
+signal=SIGRTMIN+4 => Real-time signal 4
+*** END OF TEST PSXSTRSIGNAL 1 ***
-- 
1.8.3.1



More information about the devel mailing list