summaryrefslogtreecommitdiffstats
path: root/lib/libcom_err/test
diff options
context:
space:
mode:
authorwollman <wollman@FreeBSD.org>1995-01-14 22:23:41 +0000
committerwollman <wollman@FreeBSD.org>1995-01-14 22:23:41 +0000
commit0916b5648b6e21b684e10cfba42b81769ea51035 (patch)
tree293623fcd45343b02313101f81356ff8761dec64 /lib/libcom_err/test
downloadFreeBSD-src-0916b5648b6e21b684e10cfba42b81769ea51035.zip
FreeBSD-src-0916b5648b6e21b684e10cfba42b81769ea51035.tar.gz
The Common Error Description Library, developed by MIT SIPB and used by
a number of (ex-)Athena programs. Breaking my own rules for importing somewhat, as this code does not appear to be actively maintained by anyone (not that it really needs it).
Diffstat (limited to 'lib/libcom_err/test')
-rw-r--r--lib/libcom_err/test/test.c47
-rw-r--r--lib/libcom_err/test/test1.et69
-rw-r--r--lib/libcom_err/test/test2.et9
3 files changed, 125 insertions, 0 deletions
diff --git a/lib/libcom_err/test/test.c b/lib/libcom_err/test/test.c
new file mode 100644
index 0000000..955cb96
--- /dev/null
+++ b/lib/libcom_err/test/test.c
@@ -0,0 +1,47 @@
+#include <stdio.h>
+#include <errno.h>
+#include "com_err.h"
+#include "test1.h"
+#include "test2.h"
+
+extern int sys_nerr, errno;
+
+main()
+{
+ printf("Before initiating error table:\n\n");
+ printf("Table name '%s'\n", error_table_name(KRB_MK_AP_TGTEXP));
+ printf("UNIX name '%s'\n", error_table_name(EPERM));
+ printf("Msg TGT-expired is '%s'\n", error_message(KRB_MK_AP_TGTEXP));
+ printf("Msg EPERM is '%s'\n", error_message(EPERM));
+ printf("Msg FOO_ERR is '%s'\n", error_message(FOO_ERR));
+ printf("Msg {sys_nerr-1} is '%s'\n", error_message(sys_nerr-1));
+ printf("Msg {sys_nerr} is '%s'\n", error_message(sys_nerr));
+
+ printf("With 0: tgt-expired -> %s\n", error_message(KRB_MK_AP_TGTEXP));
+
+ initialize_krb_error_table();
+ printf("KRB error table initialized: base %d (%s), name %s\n",
+ ERROR_TABLE_BASE_krb, error_message(ERROR_TABLE_BASE_krb),
+ error_table_name(ERROR_TABLE_BASE_krb));
+ initialize_krb_error_table();
+ printf("With krb: tgt-expired -> %s\n",
+ error_message(KRB_MK_AP_TGTEXP));
+
+ initialize_quux_error_table();
+ printf("QUUX error table initialized: base %d (%s), name %s\n",
+ ERROR_TABLE_BASE_quux, error_message(ERROR_TABLE_BASE_quux),
+ error_table_name(ERROR_TABLE_BASE_quux));
+
+ printf("Msg for TGT-expired is '%s'\n",
+ error_message(KRB_MK_AP_TGTEXP));
+ printf("Msg {sys_nerr-1} is '%s'\n", error_message(sys_nerr-1));
+ printf("Msg FOO_ERR is '%s'\n", error_message(FOO_ERR));
+ printf("Msg KRB_SKDC_CANT is '%s'\n",
+ error_message(KRB_SKDC_CANT));
+ printf("Msg 1e6 (8B 64) is '%s'\n", error_message(1000000));
+ printf("\n\nCOM_ERR tests:\n");
+ com_err("whoami", FOO_ERR, (char *)NULL);
+ com_err("whoami", FOO_ERR, " -- message goes %s", "here");
+ com_err("whoami", 0, (char *)0);
+ com_err("whoami", 0, "error number %d\n", 0);
+}
diff --git a/lib/libcom_err/test/test1.et b/lib/libcom_err/test/test1.et
new file mode 100644
index 0000000..4c7b77f
--- /dev/null
+++ b/lib/libcom_err/test/test1.et
@@ -0,0 +1,69 @@
+ error_table krb
+
+ error_code KRB_MK_AP_TKFIL,
+ "Can't read ticket file"
+
+ ec KRB_MK_AP_NOTKT,
+ "Can't find ticket or TGT"
+
+ ec KRB_MK_AP_TGTEXP,
+ "TGT expired"
+
+ ec KRB_RD_AP_UNDEC,
+ "Can't decode authenticator"
+
+ ec KRB_RD_AP_EXP,
+ "Ticket expired"
+
+ ec KRB_RD_AP_REPEAT,
+ "Repeated request"
+
+ ec KRB_RD_AP_NOT_US,
+ "The ticket isn't for us"
+
+ ec KRB_RD_AP_INCON,
+ "Request is inconsistent"
+
+ ec KRB_RD_AP_TIME,
+ "Delta-T too big"
+
+ ec KRB_RD_AP_BADD,
+ "Incorrect net address"
+
+ ec KRB_RD_AP_VERSION,
+ "Protocol version mismatch"
+
+ ec KRB_RD_AP_MSG_TYPE,
+ "Invalid message type"
+
+ ec KRB_RD_AP_MODIFIED,
+ "Message stream modified"
+
+ ec KRB_RD_AP_ORDER,
+ "Message out of order"
+
+ ec KRB_RD_AP_UNAUTHOR,
+ "Unauthorized request"
+
+ ec KRB_GT_PW_NULL,
+ "Current password is null"
+
+ ec KRB_GT_PW_BADPW,
+ "Incorrect current password"
+
+ ec KRB_GT_PW_PROT,
+ "Protocol error"
+
+ ec KRB_GT_PW_KDCERR,
+ "Error returned by KDC"
+
+ ec KRB_GT_PW_NULLTKT,
+ "Null ticket returned by KDC"
+
+ ec KRB_SKDC_RETRY,
+ "Retry count exceeded"
+
+ ec KRB_SKDC_CANT,
+ "Can't send request"
+
+ end
diff --git a/lib/libcom_err/test/test2.et b/lib/libcom_err/test/test2.et
new file mode 100644
index 0000000..55ad74e
--- /dev/null
+++ b/lib/libcom_err/test/test2.et
@@ -0,0 +1,9 @@
+ error_table quux
+
+ ec FOO_ERR, "foo"
+
+ ec BAR_ERR, "bar"
+
+ ec BAZ_ERR, "meow"
+
+ end
OpenPOWER on IntegriCloud