summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoel Sherrill <joel@rtems.org>2017-03-15 12:59:47 -0500
committerJoel Sherrill <joel@rtems.org>2017-03-15 12:59:47 -0500
commit191d39a5c4c9596a24a2689e4955980f459e2022 (patch)
treebaf22b3759ff3ed8ce8b39afd413c3929ace02e6
parenttools/build/eolstrip.c: Use snprintf() to avoid potential buffer overflow (diff)
downloadrtems-191d39a5c4c9596a24a2689e4955980f459e2022.tar.bz2
psxstrsignal01: New test
-rw-r--r--testsuites/psxtests/Makefile.am2
-rw-r--r--testsuites/psxtests/configure.ac1
-rw-r--r--testsuites/psxtests/psxstrsignal01/Makefile.am24
-rw-r--r--testsuites/psxtests/psxstrsignal01/init.c115
-rw-r--r--testsuites/psxtests/psxstrsignal01/psxstrsignal01.doc19
-rw-r--r--testsuites/psxtests/psxstrsignal01/psxstrsignal01.scn38
6 files changed, 198 insertions, 1 deletions
diff --git a/testsuites/psxtests/Makefile.am b/testsuites/psxtests/Makefile.am
index 2bea8ab199..a00aea40d5 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 77af14ed47..3211a8d380 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 0000000000..f35399904e
--- /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@.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 0000000000..82b517fc66
--- /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 0000000000..43b362d0be
--- /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 0000000000..969f9f0455
--- /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 ***