TS_HELPER_PATHS="${ts_helpersdir}test_pathnames"
TS_HELPER_SCRIPT="${ts_helpersdir}test_script"
TS_HELPER_SIGRECEIVE="${ts_helpersdir}test_sigreceive"
+TS_HELPER_STRERROR="${ts_helpersdir}test_strerror"
TS_HELPER_STRUTILS="${ts_helpersdir}test_strutils"
TS_HELPER_SYSINFO="${ts_helpersdir}test_sysinfo"
TS_HELPER_TIOCSTI="${ts_helpersdir}test_tiocsti"
-col: failed on line 1: Invalid or incomplete multibyte or wide character
+col: failed on line 1: EILSEQ
check_PROGRAMS += test_pathnames
test_pathnames_SOURCES = tests/helpers/test_pathnames.c
+check_PROGRAMS += test_strerror
+test_strerror_SOURCES = tests/helpers/test_strerror.c
+
check_PROGRAMS += test_sysinfo
test_sysinfo_SOURCES = tests/helpers/test_sysinfo.c
--- /dev/null
+/*
+ * This test program prints errno messages to allow for portable
+ * verification of error messages.
+ *
+ * Copyright (C) 2019 Patrick Steinhardt <ps@pks.im
+ *
+ * This file may be redistributed under the terms of the GNU Public
+ * License.
+ */
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define E(x) { #x, x }
+static struct {
+ const char *str;
+ int error;
+} errors[] = {
+ E(EILSEQ)
+};
+
+int main(int argc, const char *argv[])
+{
+ size_t i;
+
+ if (argc != 2) {
+ fprintf(stderr, "USAGE: %s <errno>\n", argv[0]);
+ return -1;
+ }
+
+ for (i = 0; i < sizeof(errors)/sizeof(*errors); i++) {
+ if (strcmp(errors[i].str, argv[1]))
+ continue;
+ puts(strerror(errors[i].error));
+ return 0;
+ }
+
+ fprintf(stderr, "Invalid errno: %s\n", argv[1]);
+ return -1;
+}
ts_init "$*"
ts_check_test_command "$TS_CMD_COL"
+ts_check_test_command "$TS_HELPER_STRERROR"
-cat $TS_SELF/multibyte.data | $TS_CMD_COL > /dev/null 2> $TS_OUTPUT
+cat $TS_SELF/multibyte.data | LC_ALL=C.UTF-8 $TS_CMD_COL 2>&1 > /dev/null |
+ sed -e "s@$($TS_HELPER_STRERROR EILSEQ)@EILSEQ@" > $TS_OUTPUT
ts_finalize
-