root/maint/gnulib/tests/test-sigabbrev_np.c

/* [previous][next][first][last][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. main

   1 /* Test of sigabbrev_np() function.
   2 
   3    Copyright (C) 2020-2021 Free Software Foundation, Inc.
   4 
   5    This program is free software; you can redistribute it and/or modify
   6    it under the terms of the GNU General Public License as published by
   7    the Free Software Foundation; either version 3, or (at your option)
   8    any later version.
   9 
  10    This program is distributed in the hope that it will be useful,
  11    but WITHOUT ANY WARRANTY; without even the implied warranty of
  12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13    GNU General Public License for more details.
  14 
  15    You should have received a copy of the GNU General Public License
  16    along with this program; if not, see <https://www.gnu.org/licenses/>.  */
  17 
  18 #include <config.h>
  19 
  20 /* Specification.  */
  21 #include <string.h>
  22 
  23 #include "signature.h"
  24 SIGNATURE_CHECK (sigabbrev_np, const char *, (int));
  25 
  26 #include <signal.h>
  27 
  28 #include "macros.h"
  29 
  30 int
  31 main (void)
     /* [previous][next][first][last][top][bottom][index][help] */
  32 {
  33   /* Signals specified by ISO C.  */
  34   ASSERT (strcmp (sigabbrev_np (SIGABRT), "ABRT") == 0);
  35   ASSERT (strcmp (sigabbrev_np (SIGFPE), "FPE") == 0);
  36   ASSERT (strcmp (sigabbrev_np (SIGILL), "ILL") == 0);
  37   ASSERT (strcmp (sigabbrev_np (SIGINT), "INT") == 0);
  38   ASSERT (strcmp (sigabbrev_np (SIGSEGV), "SEGV") == 0);
  39   ASSERT (strcmp (sigabbrev_np (SIGTERM), "TERM") == 0);
  40 
  41   /* Signals specified by POSIX.
  42      <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/signal.h.html>  */
  43   #ifdef SIGALRM
  44   ASSERT (strcmp (sigabbrev_np (SIGALRM), "ALRM") == 0);
  45   #endif
  46   #ifdef SIGBUS
  47   ASSERT (strcmp (sigabbrev_np (SIGBUS), "BUS") == 0);
  48   #endif
  49   #ifdef SIGCHLD
  50   ASSERT (strcmp (sigabbrev_np (SIGCHLD), "CHLD") == 0);
  51   #endif
  52   #ifdef SIGCONT
  53   ASSERT (strcmp (sigabbrev_np (SIGCONT), "CONT") == 0);
  54   #endif
  55   #ifdef SIGHUP
  56   ASSERT (strcmp (sigabbrev_np (SIGHUP), "HUP") == 0);
  57   #endif
  58   #ifdef SIGKILL
  59   ASSERT (strcmp (sigabbrev_np (SIGKILL), "KILL") == 0);
  60   #endif
  61   #ifdef SIGPIPE
  62   ASSERT (strcmp (sigabbrev_np (SIGPIPE), "PIPE") == 0);
  63   #endif
  64   #ifdef SIGQUIT
  65   ASSERT (strcmp (sigabbrev_np (SIGQUIT), "QUIT") == 0);
  66   #endif
  67   #ifdef SIGSTOP
  68   ASSERT (strcmp (sigabbrev_np (SIGSTOP), "STOP") == 0);
  69   #endif
  70   #ifdef SIGTSTP
  71   ASSERT (strcmp (sigabbrev_np (SIGTSTP), "TSTP") == 0);
  72   #endif
  73   #ifdef SIGTTIN
  74   ASSERT (strcmp (sigabbrev_np (SIGTTIN), "TTIN") == 0);
  75   #endif
  76   #ifdef SIGTTOU
  77   ASSERT (strcmp (sigabbrev_np (SIGTTOU), "TTOU") == 0);
  78   #endif
  79   #ifdef SIGUSR1
  80   ASSERT (strcmp (sigabbrev_np (SIGUSR1), "USR1") == 0);
  81   #endif
  82   #ifdef SIGUSR2
  83   ASSERT (strcmp (sigabbrev_np (SIGUSR2), "USR2") == 0);
  84   #endif
  85   #ifdef SIGPOLL
  86   ASSERT (strcmp (sigabbrev_np (SIGPOLL), "POLL") == 0);
  87   #endif
  88   #ifdef SIGPROF
  89   ASSERT (strcmp (sigabbrev_np (SIGPROF), "PROF") == 0);
  90   #endif
  91   #ifdef SIGSYS
  92   ASSERT (strcmp (sigabbrev_np (SIGSYS), "SYS") == 0);
  93   #endif
  94   #ifdef SIGTRAP
  95   ASSERT (strcmp (sigabbrev_np (SIGTRAP), "TRAP") == 0);
  96   #endif
  97   #ifdef SIGURG
  98   ASSERT (strcmp (sigabbrev_np (SIGURG), "URG") == 0);
  99   #endif
 100   #ifdef SIGVTALRM
 101   ASSERT (strcmp (sigabbrev_np (SIGVTALRM), "VTALRM") == 0);
 102   #endif
 103   #ifdef SIGXCPU
 104   ASSERT (strcmp (sigabbrev_np (SIGXCPU), "XCPU") == 0);
 105   #endif
 106   #ifdef SIGXFSZ
 107   ASSERT (strcmp (sigabbrev_np (SIGXFSZ), "XFSZ") == 0);
 108   #endif
 109 
 110   /* Other signals on other systems.  */
 111   /* native Windows */
 112   #ifdef SIGBREAK
 113   ASSERT (strcmp (sigabbrev_np (SIGBREAK), "BREAK") == 0);
 114   #endif
 115   /* IRIX */
 116   #ifdef SIGCKPT
 117   ASSERT (strcmp (sigabbrev_np (SIGCKPT), "CKPT") == 0);
 118   #endif
 119   /* AIX */
 120   #ifdef SIGCPUFAIL
 121   ASSERT (strcmp (sigabbrev_np (SIGCPUFAIL), "CPUFAIL") == 0);
 122   #endif
 123   /* AIX */
 124   #ifdef SIGDANGER
 125   ASSERT (strcmp (sigabbrev_np (SIGDANGER), "DANGER") == 0);
 126   #endif
 127   /* Mac OS X, FreeBSD, NetBSD, OpenBSD, Minix, AIX, IRIX, Cygwin, mingw */
 128   #ifdef SIGEMT
 129   ASSERT (strcmp (sigabbrev_np (SIGEMT), "EMT") == 0);
 130   #endif
 131   /* Mac OS X, FreeBSD, NetBSD, OpenBSD, Minix */
 132   #if defined SIGINFO && SIGINFO != SIGPWR
 133   ASSERT (strcmp (sigabbrev_np (SIGINFO), "INFO") == 0);
 134   #endif
 135   /* AIX */
 136   #ifdef SIGKAP
 137   ASSERT (strcmp (sigabbrev_np (SIGKAP), "KAP") == 0);
 138   #endif
 139   /* Haiku */
 140   #ifdef SIGKILLTHR
 141   ASSERT (strcmp (sigabbrev_np (SIGKILLTHR), "KILLTHR") == 0);
 142   #endif
 143   /* Minix */
 144   #ifdef SIGKMEM
 145   ASSERT (strcmp (sigabbrev_np (SIGKMEM), "KMEM") == 0);
 146   #endif
 147   /* Minix */
 148   #ifdef SIGKMESS
 149   ASSERT (strcmp (sigabbrev_np (SIGKMESS), "KMESS") == 0);
 150   #endif
 151   /* Minix */
 152   #ifdef SIGKSIG
 153   ASSERT (strcmp (sigabbrev_np (SIGKSIG), "KSIG") == 0);
 154   #endif
 155   /* Minix */
 156   #ifdef SIGKSIGSM
 157   ASSERT (strcmp (sigabbrev_np (SIGKSIGSM), "KSIGSM") == 0);
 158   #endif
 159   /* FreeBSD */
 160   #ifdef SIGLIBRT
 161   ASSERT (strcmp (sigabbrev_np (SIGLIBRT), "LIBRT") == 0);
 162   #endif
 163   /* AIX */
 164   #ifdef SIGMIGRATE
 165   ASSERT (strcmp (sigabbrev_np (SIGMIGRATE), "MIGRATE") == 0);
 166   #endif
 167   /* AIX */
 168   #ifdef SIGMSG
 169   ASSERT (strcmp (sigabbrev_np (SIGMSG), "MSG") == 0);
 170   #endif
 171   /* AIX */
 172   #ifdef SIGPRE
 173   ASSERT (strcmp (sigabbrev_np (SIGPRE), "PRE") == 0);
 174   #endif
 175   /* IRIX */
 176   #ifdef SIGPTINTR
 177   ASSERT (strcmp (sigabbrev_np (SIGPTINTR), "PTINTR") == 0);
 178   #endif
 179   /* IRIX */
 180   #ifdef SIGPTRESCHED
 181   ASSERT (strcmp (sigabbrev_np (SIGPTRESCHED), "PTRESCHED") == 0);
 182   #endif
 183   /* Linux, NetBSD, Minix, AIX, IRIX, Cygwin */
 184   #ifdef SIGPWR
 185   ASSERT (strcmp (sigabbrev_np (SIGPWR), "PWR") == 0);
 186   #endif
 187   /* AIX */
 188   #ifdef SIGRECONFIG
 189   ASSERT (strcmp (sigabbrev_np (SIGRECONFIG), "RECONFIG") == 0);
 190   #endif
 191   /* AIX */
 192   #ifdef SIGRECOVERY
 193   ASSERT (strcmp (sigabbrev_np (SIGRECOVERY), "RECOVERY") == 0);
 194   #endif
 195   /* IRIX */
 196   #ifdef SIGRESTART
 197   ASSERT (strcmp (sigabbrev_np (SIGRESTART), "RESTART") == 0);
 198   #endif
 199   /* AIX */
 200   #ifdef SIGRETRACT
 201   ASSERT (strcmp (sigabbrev_np (SIGRETRACT), "RETRACT") == 0);
 202   #endif
 203   /* AIX */
 204   #ifdef SIGSAK
 205   ASSERT (strcmp (sigabbrev_np (SIGSAK), "SAK") == 0);
 206   #endif
 207   /* Minix */
 208   #ifdef SIGSNDELAY
 209   ASSERT (strcmp (sigabbrev_np (SIGSNDELAY), "SNDELAY") == 0);
 210   #endif
 211   /* AIX */
 212   #ifdef SIGSOUND
 213   ASSERT (strcmp (sigabbrev_np (SIGSOUND), "SOUND") == 0);
 214   #endif
 215   /* Linux */
 216   #ifdef SIGSTKFLT
 217   ASSERT (strcmp (sigabbrev_np (SIGSTKFLT), "STKFLT") == 0);
 218   #endif
 219   /* AIX */
 220   #ifdef SIGSYSERROR
 221   ASSERT (strcmp (sigabbrev_np (SIGSYSERROR), "SYSERROR") == 0);
 222   #endif
 223   /* AIX */
 224   #ifdef SIGTALRM
 225   ASSERT (strcmp (sigabbrev_np (SIGTALRM), "TALRM") == 0);
 226   #endif
 227   /* FreeBSD, OpenBSD */
 228   #ifdef SIGTHR
 229   ASSERT (strcmp (sigabbrev_np (SIGTHR), "THR") == 0);
 230   #endif
 231   /* IRIX */
 232   #ifdef SIGUME
 233   ASSERT (strcmp (sigabbrev_np (SIGUME), "UME") == 0);
 234   #endif
 235   /* AIX */
 236   #ifdef SIGVIRT
 237   ASSERT (strcmp (sigabbrev_np (SIGVIRT), "VIRT") == 0);
 238   #endif
 239   /* AIX */
 240   #ifdef SIGWAITING
 241   ASSERT (strcmp (sigabbrev_np (SIGWAITING), "WAITING") == 0);
 242   #endif
 243   /* Linux, Mac OS X, FreeBSD, NetBSD, OpenBSD, Minix, AIX, IRIX, Cygwin, Haiku */
 244   #ifdef SIGWINCH
 245   ASSERT (strcmp (sigabbrev_np (SIGWINCH), "WINCH") == 0);
 246   #endif
 247 
 248   ASSERT (sigabbrev_np (-714) == NULL);
 249 
 250   return 0;
 251 }

/* [previous][next][first][last][top][bottom][index][help] */