diff options
Diffstat (limited to 'PACE/tests')
-rw-r--r-- | PACE/tests/Makefile | 84 | ||||
-rw-r--r-- | PACE/tests/Makefile.am | 54 | ||||
-rw-r--r-- | PACE/tests/Posix_SP_Test.c | 238 | ||||
-rw-r--r-- | PACE/tests/README | 0 | ||||
-rw-r--r-- | PACE/tests/Stdio_Test.c | 116 | ||||
-rw-r--r-- | PACE/tests/mqueue_test.c | 122 |
6 files changed, 0 insertions, 614 deletions
diff --git a/PACE/tests/Makefile b/PACE/tests/Makefile deleted file mode 100644 index 65d3795d0ab..00000000000 --- a/PACE/tests/Makefile +++ /dev/null @@ -1,84 +0,0 @@ -#---------------------------------------------------------------------------- -# -# $Id$ -# -# Makefile for all the PACE tests -#---------------------------------------------------------------------------- - -ifndef static_libs_only - ifndef shared_libs_only - static_libs_only = 1 - endif # shared_libs_only -endif # static_libs_only - -# If we are inlining the PACE functions then we don't want to include -# the PACE library (and we need to define PACE_HAS_INLINE). If we're not -# inlining then we need to include the PACE library. Inlining is the default. - -ifndef inline - CFLAGS += -DPACE_HAS_INLINE -else - ifneq (0,$(inline)) - CFLAGS += -DPACE_HAS_INLINE - else - LIBS += -L$(ACE_ROOT)/PACE/pace -lPACE - endif # ! inline -endif # ! inline - -CFLAGS += -DPACE_HAS_ALL_POSIX_FUNCS - -#---------------------------------------------------------------------------- -# Local macros -#---------------------------------------------------------------------------- - -BIN = Stdio_Test \ - Posix_SP_Test \ - mqueue_test - -#### If the PACE library wasn't built with all components, don't -#### try to build certain tests. -PACE_BUILD_COMPONENTS := $(shell sh $(ACE_ROOT)/bin/ace_components --pace) - -PSRC=$(addsuffix .c,$(BIN)) - -#---------------------------------------------------------------------------- -# Include macros and targets -#---------------------------------------------------------------------------- - -include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU -ACELIB = -INCLDIRS += -I$(PACE_ROOT) -include $(ACE_ROOT)/include/makeinclude/macros.GNU -include $(ACE_ROOT)/include/makeinclude/rules.common.GNU -include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU -include $(ACE_ROOT)/include/makeinclude/rules.bin.GNU - -ifndef SOEXT - SOEXT=so -endif - -include $(ACE_ROOT)/include/makeinclude/rules.local.GNU - -include $(ACE_ROOT)/PACE/include/makeinclude/rules.common.GNU - -# To compile in the PACE lib on platforms that compile c code -ifeq (1, $(emulation)) - LIBS += -L$(PACE_ROOT)/pace -lPACE -endif # emulation - -# To build multiple executables in the same directory on AIX, it works -# best to wipe out any previously-created tempinc directory. -# The compiler/linker isn't too smart about instantiating templates... -ifdef TEMPINCDIR -COMPILE.cc := $(RM) -rf tempinc; $(COMPILE.cc) -endif - -#---------------------------------------------------------------------------- -# Local targets -#---------------------------------------------------------------------------- - -#---------------------------------------------------------------------------- -# Dependencies -#---------------------------------------------------------------------------- -# DO NOT DELETE THIS LINE -- g++dep uses it. -# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. diff --git a/PACE/tests/Makefile.am b/PACE/tests/Makefile.am deleted file mode 100644 index af6f453c2af..00000000000 --- a/PACE/tests/Makefile.am +++ /dev/null @@ -1,54 +0,0 @@ -##---------------------------------------------------------------------------- -## $Id$ -## -## Makefile.am for all the PACE ``one-button'' tests -##---------------------------------------------------------------------------- - -## -## Process this file with automake to create Makefile.in -## - -## The number in AUTOMAKE_OPTIONS is the minimum required version automake -## needed to process this file. -AUTOMAKE_OPTIONS = 1.4 - -INCLUDES = -I$(top_builddir) -I$(top_srcdir) - -## LDFLAGS = -## Libtool will automatically link against the "proper" library. -## Do not change the "libACE.la." It is not a typographical error! -## -## We override the "LIBS" variable provided by the configure script since -## we should only need to link against the ACE library for these tests. -LDADD = $(top_builddir)/pace/libPACE.la -##LIBS = $(top_builddir)/pace/libPACE.la - -## Build the following test programs when a `make check' is -## issued by the user. -check_PROGRAMS = \ - Posix_SP_Test \ - Stdio_Test - -Posix_SP_Test_SOURCES = Posix_SP_Test.c - -Stdio_Test_SOURCES = Stdio_Test.c - -## The tests we want to run are all of the test programs we are going to build. -## Do not run them if they are cross-compiled. -if PACE_CROSS_COMPILED -TESTS = -else -TESTS = $(check_PROGRAMS) -endif - -## Set up the test environment -##TESTS_ENVIRONMENT = - -## Clean up template repositories, etc. -clean-local: - -rm -f *.bak *.rpo *.sym lib*.*_pure_* Makefile.old core - -rm -rf ptrepository Templates.DB gcctemp.c gcctemp so_locations - -## Clean up `log' directory , etc. -distclean-local: - -rm -rf log diff --git a/PACE/tests/Posix_SP_Test.c b/PACE/tests/Posix_SP_Test.c deleted file mode 100644 index 12d8ff5b89a..00000000000 --- a/PACE/tests/Posix_SP_Test.c +++ /dev/null @@ -1,238 +0,0 @@ -/* $Id$ -*- C -*- */ - -/* ===================================================================== - * - * = FILENAME - * Posix_SP_Test.c - * - * = DESCRIPTION - * Testing the platform for POSIX_SINGLE_PROCESS unit of - * functionality. This consists of calls to sysconf, time, and - * uname. - * This is not meant to be an exhaustive test at this point but more - * a sanity check that PACE works (at least somewhat). - * - * = AUTHOR - * Joe Hoffert <joeh@cs.wustl.edu> - * - * ===================================================================== - */ - -#include "pace/stdio.h" -#include "pace/unistd.h" -#include "pace/time.h" -#include "pace/sys/utsname.h" - -const char * success = "SUCCEEDED"; -const char * failure = "***FAILED***"; - -void -check_sysconf () -{ - long retval; - int index; -#if PACE_HAS_POSIX == PACE_LYNXOS - const int confnamessize = 30; -#else - const int confnamessize = 38; -#endif /* PACE_HAS_POSIX != PACE_LYNXOS */ - - int confnames[] = {_SC_AIO_LISTIO_MAX, - _SC_AIO_MAX, - _SC_AIO_PRIO_DELTA_MAX, - _SC_ARG_MAX, - _SC_CHILD_MAX, - _SC_CLK_TCK, - _SC_DELAYTIMER_MAX, -#if PACE_HAS_POSIX != PACE_LYNXOS - _SC_GETGR_R_SIZE_MAX, - _SC_GETPW_R_SIZE_MAX, - _SC_LOGIN_NAME_MAX, -#endif /* PACE_HAS_POSIX != PACE_LYNXOS */ - _SC_MQ_OPEN_MAX, - _SC_MQ_PRIO_MAX, - _SC_NGROUPS_MAX, - _SC_OPEN_MAX, - _SC_PAGESIZE, - _SC_RTSIG_MAX, - _SC_SEM_NSEMS_MAX, - _SC_SEM_VALUE_MAX, - _SC_SIGQUEUE_MAX, - _SC_STREAM_MAX, -#if PACE_HAS_POSIX != PACE_LYNXOS - _SC_THREAD_DESTRUCTOR_ITERATIONS, - _SC_THREAD_KEYS_MAX, - _SC_THREAD_STACK_MIN, - _SC_THREAD_THREADS_MAX, -#endif /* PACE_HAS_POSIX != PACE_LYNXOS */ - _SC_TIMER_MAX, -#if PACE_HAS_POSIX != PACE_LYNXOS - _SC_TTY_NAME_MAX, -#endif /* PACE_HAS_POSIX != PACE_LYNXOS */ - _SC_TZNAME_MAX, - _SC_ASYNCHRONOUS_IO, - _SC_FSYNC, - _SC_JOB_CONTROL, - _SC_MAPPED_FILES, - _SC_MEMLOCK, - _SC_MEMLOCK_RANGE, - _SC_MEMORY_PROTECTION, - _SC_MESSAGE_PASSING, - _SC_PRIORITIZED_IO, - _SC_PRIORITY_SCHEDULING, - _SC_REALTIME_SIGNALS}; - char * confstrs[] = {"_SC_AIO_LISTIO_MAX", - "_SC_AIO_MAX", - "_SC_AIO_PRIO_DELTA_MAX", - "_SC_ARG_MAX", - "_SC_CHILD_MAX", - "_SC_CLK_TCK", - "_SC_DELAYTIMER_MAX", -#if PACE_HAS_POSIX != PACE_LYNXOS - "_SC_GETGR_R_SIZE_MAX", - "_SC_GETPW_R_SIZE_MAX", - "_SC_LOGIN_NAME_MAX", -#endif /* PACE_HAS_POSIX != PACE_LYNXOS */ - "_SC_MQ_OPEN_MAX", - "_SC_MQ_PRIO_MAX", - "_SC_NGROUPS_MAX", - "_SC_OPEN_MAX", - "_SC_PAGESIZE", - "_SC_RTSIG_MAX", - "_SC_SEM_NSEMS_MAX", - "_SC_SEM_VALUE_MAX", - "_SC_SIGQUEUE_MAX", - "_SC_STREAM_MAX", -#if PACE_HAS_POSIX != PACE_LYNXOS - "_SC_THREAD_DESTRUCTOR_ITERATIONS", - "_SC_THREAD_KEYS_MAX", - "_SC_THREAD_STACK_MIN", - "_SC_THREAD_THREADS_MAX", -#endif /* PACE_HAS_POSIX != PACE_LYNXOS */ - "_SC_TIMER_MAX", -#if PACE_HAS_POSIX != PACE_LYNXOS - "_SC_TTY_NAME_MAX", -#endif /* PACE_HAS_POSIX != PACE_LYNXOS */ - "_SC_TZNAME_MAX", - "_SC_ASYNCHRONOUS_IO", - "_SC_FSYNC", - "_SC_JOB_CONTROL", - "_SC_MAPPED_FILES", - "_SC_MEMLOCK", - "_SC_MEMLOCK_RANGE", - "_SC_MEMORY_PROTECTION", - "_SC_MESSAGE_PASSING", - "_SC_PRIORITIZED_IO", - "_SC_PRIORITY_SCHEDULING", - "_SC_REALTIME_SIGNALS"}; - - printf("pace_sysconf %s\n", success); - for (index = 0; index < confnamessize; index++) - { - /* Call pace_sysconf() */ - errno = 0; - retval = pace_sysconf(confnames[index]); - - /* Return value of -1 indicates an invalid name or no support - for the functionality associated with the name. POSIX- - conformant platforms may not support all the names. However, - using the names above should not cause compilation errors. - */ - printf("pace_sysconf: name == %s\n", confstrs[index]); - if (retval == -1) - { - printf("retval == %ld\n", retval); - if (errno == 0) - { - printf("Unsupported name [errno did not change]\n"); - } - else - { - printf("invalid name [errno did not change]\n"); - } - } - else - { - printf("pace_sysconf: value == %ld\n", retval); - } - } - - printf("\n"); -} - -void -check_time () -{ - long retval; - time_t local_time; - - /* Call pace_time() with time_t * arg */ - local_time = 0; - errno = 0; - retval = pace_time(&local_time); - - printf("pace_time %s\n", success); - if (retval == -1) - { - printf("errno == %d\n", errno); - } - else - { - printf("pace_time (with time_t* arg) == %ld\n", local_time); - } - - /* Call pace_time() with NULL arg */ - errno = 0; - retval = pace_time(0); - - if (retval == -1) - { - printf("errno == %d\n", errno); - } - else - { - printf("pace_time (with NULL arg) == %ld\n\n", retval); - } -} - -void -check_uname () -{ - long retval; - struct utsname name; - - /* Call pace_uname() */ - errno = 0; - retval = pace_uname(&name); - printf("pace_uname %s\n", success); - - if (retval < 0) - { - printf("pace_uname error: %d\n", errno); - } - else - { - printf("pace_uname: uname.sysname == %s\n", name.sysname); - printf("pace_uname: uname.nodename == %s\n", name.nodename); - printf("pace_uname: uname.release == %s\n", name.release); - printf("pace_uname: uname.version == %s\n", name.version); - printf("pace_uname: uname.machine == %s\n", name.machine); - } -} - -int -main (int argc, char **argv) -{ - /* Check the PACE calls to the sysconf POSIX function. */ - check_sysconf(); - - /* Check the PACE calls to the time POSIX function. */ - check_time(); - - /* Check the PACE calls to the uname POSIX function. */ - check_uname(); - - PACE_UNUSED_ARG (argc); - PACE_UNUSED_ARG (argv); - return 0; -} diff --git a/PACE/tests/README b/PACE/tests/README deleted file mode 100644 index e69de29bb2d..00000000000 --- a/PACE/tests/README +++ /dev/null diff --git a/PACE/tests/Stdio_Test.c b/PACE/tests/Stdio_Test.c deleted file mode 100644 index 65054786616..00000000000 --- a/PACE/tests/Stdio_Test.c +++ /dev/null @@ -1,116 +0,0 @@ -/* $Id$ -*- C -*- */ - -/* ===================================================================== */ -/* */ -/* = FILENAME */ -/* Stdio_Test.c */ -/* */ -/* = DESCRIPTION */ -/* Testing the platform for POSIX standard I/O. This is not meant */ -/* to be an exhaustive test at this point but more a sanity check */ -/* that PACE works (at least somewhat) as advertised. */ -/* This program creates/opens a temporary file, writes to the file, */ -/* reads from the file to make sure it's what was written, and */ -/* then closes/deletes the file. */ -/* */ -/* = AUTHOR */ -/* Joe Hoffert <joeh@cs.wustl.edu> */ -/* */ -/* ===================================================================== */ - -#include "pace/stdio.h" - -const char * filename = "temp"; -const char * mode = "w+"; -const char * string1 = "line 1\n"; -const char * success = "SUCCEEDED"; -const char * failure = "***FAILED***"; - -int -main (int argc, char **argv) -{ - /* Test creating/opening a file. */ - PACE_FILE *file; - int retval; - char* retval2; - char buffer[256]; - - file = pace_fopen (filename, - mode); - if (file == 0) - { - printf("pace_fopen %s\n", failure); - return -1; - } - - printf("pace_fopen %s\n", success); - - /* Test writing to a file. */ - retval = pace_fputs (string1, - file); - if (retval == EOF) - { - printf("pace_fputs %s\n", failure); - return -1; - } - - printf("pace_fputs %s\n", success); - - /* Test flushing a file. */ - retval = pace_fflush (file); - if (retval != 0) - { - printf("pace_fflush %s\n", failure); - return -1; - } - - printf("pace_fflush %s\n", success); - - /* Test seeking in a file. */ - retval = pace_fseek (file, - 0, - 0); - if (retval != 0) - { - printf("pace_fseek %s\n", failure); - return -1; - } - - printf("pace_fseek %s\n", success); - - /* Test reading from a file. */ - retval2 = pace_fgets (buffer, - sizeof(buffer), - file); - if (retval2 == 0) - { - printf("pace_fgets %s\n", failure); - return -1; - } - - printf("pace_fgets %s\n", success); - - if (strcmp(buffer, - string1) != 0) - { - printf("strcmp of pace_fgets %s\n", failure); - return -1; - } - - printf("strcmp of pace_fgets %s\n", success); - - /* Test closing a file. */ - retval = pace_fclose (file); - if (retval != 0) - { - printf("pace_fclose %s\n", failure); - return -1; - } - - printf("pace_fclose %s\n", success); - - - PACE_UNUSED_ARG (argc); - PACE_UNUSED_ARG (argv); - return 0; -} diff --git a/PACE/tests/mqueue_test.c b/PACE/tests/mqueue_test.c deleted file mode 100644 index f7cf87b093b..00000000000 --- a/PACE/tests/mqueue_test.c +++ /dev/null @@ -1,122 +0,0 @@ -/* $Id$ */ - -#include "pace/stdio.h" -#include "pace/fcntl.h" -#include "pace/mqueue.h" -#include "pace/stdlib.h" -#include "pace/signal.h" -#include "pace/string.h" - -/* Most of this code is borowed from Konstantin Knizhnik <http://www.ispras.ru/~knizhnik/posix1b/> */ - -pace_mqd_t mqdes; - -void -msg_handler (int handler_arg) -{ - char buf[1024]; - unsigned int priority; - int len = pace_mq_receive(mqdes, buf, sizeof buf, &priority); - - PACE_UNUSED_ARG (handler_arg); - - if (len < 0) - { - perror("mq_receive"); - } - pace_printf("\nReceive message with priority %d: %s\n", priority, buf); -} - -#define QUEUE_NAME "/testmsg1" - -int -main (int argc, char** argv) -{ -#if PACE_LYNXOS - pace_printf ("No errors, have occurred. On the other hand no operations have been performed either. Take what you can get I guess.\n"); - PACE_UNUSED_ARG (argc); - PACE_UNUSED_ARG (argv); - return EXIT_SUCCESS; -#else /* ! PACE_LYNXOS */ - char buf[1024]; - int choice, len; - unsigned int priority; - pace_sigevent notification; - static pace_sigaction_s sa; - int one = 1; - - mqdes = pace_mq_open(QUEUE_NAME, O_CREAT | O_RDWR, 0777, 0); - if (mqdes == (pace_mqd_t)-1) - { - perror("mq_open"); - return EXIT_FAILURE; - } - - notification.sigev_notify = SIGEV_SIGNAL; - notification.sigev_signo = SIGUSR1; - - sa.sa_handler = msg_handler; - sa.sa_flags = SA_RESTART; - pace_sigaction(SIGUSR1, &sa, NULL); - - while (one) - { - printf("\t1. Send\n" - "\t2. Asynchronouse receive\n" - "\t3. Synchronouse receive\n" - "\t4. Close queue and exit\n" - "\t5. Remove queue and exit\n" - "> "); - if (!pace_fgets(buf, sizeof buf, stdin)) - { - return EXIT_FAILURE; - } - if (pace_sscanf(buf, "%d", &choice) != 1) - { - pace_printf("Please select 1..5\n"); - continue; - } - switch (choice) - { - case 1: - do - { - pace_printf("Message priority: "); - pace_fgets(buf, sizeof buf, stdin); - } while (pace_sscanf(buf, "%d", &priority) != 1); - pace_printf("Message to send: "); - pace_fgets(buf, sizeof buf, stdin); - if (pace_mq_send(mqdes, buf, pace_strlen(buf)+1, priority) == -1) - { - perror("mq_send"); - return EXIT_FAILURE; - } - break; - case 2: - pace_mq_notify(mqdes, ¬ification); - pace_printf("Waiting for notifications...\n"); - break; - case 3: - len = pace_mq_receive(mqdes, buf, sizeof buf, &priority); - if (len < 0) - { - perror("mq_receive"); - } - pace_printf("Receive message with priority %d: %s\n", priority, buf); - break; - case 4: - pace_mq_close(mqdes); - return EXIT_SUCCESS; - case 5: - pace_mq_close(mqdes); - pace_mq_unlink(QUEUE_NAME); - return EXIT_SUCCESS; - default: - pace_printf("Please select 1..5\n"); - } - } - PACE_UNUSED_ARG (argc); - PACE_UNUSED_ARG (argv); - return EXIT_SUCCESS; -#endif /* ! PACE_LYNXOS */ -} |