summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <Alan.Coopersmith@sun.com>2006-06-10 01:27:06 +0000
committerAlan Coopersmith <Alan.Coopersmith@sun.com>2006-06-10 01:27:06 +0000
commit7f6f90cfce51806340f25b80a87b147d8a743b27 (patch)
treef6c1449f36e22b68d56b9b1c879ed91e00faf6ab
parente214cc19e1d599f16a69e86b1d8b247ad40a9ed7 (diff)
Clean up existing Autest test program and use to provide simple (and very
incomplete) "make check" test case.
-rw-r--r--Autest.c23
-rw-r--r--ChangeLog7
-rw-r--r--Makefile.am11
3 files changed, 30 insertions, 11 deletions
diff --git a/Autest.c b/Autest.c
index 2984649..12b8cbf 100644
--- a/Autest.c
+++ b/Autest.c
@@ -30,12 +30,16 @@ in this Software without prior written authorization from The Open Group.
#include <config.h>
#endif
#include <X11/Xauth.h>
+#include <stdio.h>
+#include <stdlib.h>
-main (argc, argv)
-char **argv;
+int
+main (int argc, char **argv)
{
Xauth test_data;
- char *name, *data, *file;
+ char *name = "XAU-TEST-1";
+ char *data = "Do not begin the test until instructed to do so.";
+ char *file = NULL;
int state = 0;
FILE *output;
@@ -50,10 +54,6 @@ char **argv;
++state;
}
}
- if(!file) {
- fprintf (stderr, "No file\n");
- exit (1);
- }
test_data.family = 0;
test_data.address_length = 0;
test_data.address = "";
@@ -63,9 +63,14 @@ char **argv;
test_data.name = name;
test_data.data_length = strlen (data);
test_data.data = data;
- output = fopen (file, "w");
+ if (!file) {
+ output = tmpfile();
+ } else {
+ output = fopen (file, "w");
+ }
if (output) {
- XauWriteAuth (output, &test_data);
+ state = XauWriteAuth (output, &test_data);
fclose (output);
}
+ return (state = 1) ? 0 : 1;
}
diff --git a/ChangeLog b/ChangeLog
index 7227d3e..560d476 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-06-09 Alan Coopersmith <alan.coopersmith@sun.com>
+
+ * Makefile.am:
+ * Autest.c:
+ Clean up existing Autest test program and use to provide simple
+ (and very incomplete) "make check" test case.
+
2006-05-12 Adam Jackson <ajax@freedesktop.org>
* configure.ac:
diff --git a/Makefile.am b/Makefile.am
index e2de3c8..03bf6ac 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -29,16 +29,22 @@ xauinclude_HEADERS = include/X11/Xauth.h
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = xau.pc
+check_PROGRAMS=Autest
+TESTS=Autest
+
+Autest_SOURCES=Autest.c
+Autest_LDADD=libXau.la
+
LIB_MAN_DIR_SUFFIX = $(LIB_MAN_DIR:@mandir@/man%=%)
libmandir = $(LIB_MAN_DIR)
libman_PRE = Xau.man
BUILT_SOURCES = shadows.DONE
-CLEANFILES = $(libman_DATA)
+CLEANFILES = $(libman_DATA) $(BUILT_SOURCES)
libman_DATA = $(libman_PRE:man=@LIB_MAN_SUFFIX@) \
$(Xau_shadows:=.@LIB_MAN_SUFFIX@)
-EXTRA_DIST = xau.pc.in Autest.c $(libman_PRE)
+EXTRA_DIST = xau.pc.in $(libman_PRE)
Xau_shadows = \
XauFileName \
@@ -55,6 +61,7 @@ shadows.DONE:
(for i in $(Xau_shadows:=.@LIB_MAN_SUFFIX@) ; do \
echo .so man$(LIB_MAN_DIR_SUFFIX)/Xau.$(LIB_MAN_SUFFIX) > $$i; \
done)
+ touch shadows.DONE
XORGRELSTRING = @PACKAGE_STRING@
XORGMANNAME = X Version 11