AM_CPPFLAGS = \
-include $(top_builddir)/config.h \
-I$(top_srcdir) \
- -I$(top_srcdir)/include
-
-AM_CPPFLAGS += -DTEST_PROGRAM
+ -I$(top_srcdir)/include \
+ -DLOCALEDIR=\"$(localedir)\"
noinst_PROGRAMS = test_strutils test_fileutils test_nsutils
-test_strutils_SOURCES = strutils.c
-test_fileutils_SOURCES = fileutils.c
-test_nsutils_SOURCES = nsutils.c
+test_strutils_SOURCES = test_strutils.c strutils.c
+test_fileutils_SOURCES = test_fileutils.c fileutils.c
+test_nsutils_SOURCES = test_nsutils.c nsutils.c
if (close_stream(stderr) != 0)
_exit(EXIT_FAILURE);
}
-
-#ifdef TEST_PROGRAM
-#include <stdio.h>
-int main(int argc, char *argv[])
-{
- atexit(close_stdout);
- printf("Hello, World!\n");
- return EXIT_SUCCESS;
-}
-#endif /* TEST_PROGRAM */
#include "proc/readproc.h"
#include "nsutils.h"
-#ifdef TEST_PROGRAM
-const char *get_ns_name(int id)
-{
- return NULL;
-}
-#endif /* TEST_PROGRAM */
-
/* we need to fill in only namespace information */
int ns_read(pid_t pid, proc_t *ns_task)
{
}
return rc;
}
-
-#ifdef TEST_PROGRAM
-int main(int argc, char *argv[])
-{
- printf("Hello, World!\n");
- return EXIT_SUCCESS;
-}
-#endif /* TEST_PROGRAM */
error(EXIT_FAILURE, errno, "%s: '%s'", errmesg, str);
return 0;
}
-
-#ifdef TEST_PROGRAM
-int main(int argc, char *argv[])
-{
- if (argc < 2) {
- error(EXIT_FAILURE, 0, "no arguments");
- } else if (argc < 3) {
- printf("%ld\n", strtol_or_err(argv[1], "strtol_or_err"));
- } else {
- printf("%lf\n", strtod_or_err(argv[2], "strtod_or_err"));
- }
- return EXIT_SUCCESS;
-}
-#endif /* TEST_PROGRAM */
--- /dev/null
+#include <stdio.h>
+#include <stdlib.h>
+#include "fileutils.h"
+
+int main(int argc, char *argv[])
+{
+ atexit(close_stdout);
+ printf("Hello, World!\n");
+ return EXIT_SUCCESS;
+}
--- /dev/null
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "nsutils.h"
+
+const char *get_ns_name(int id)
+{
+ return NULL;
+}
+
+int main(int argc, char *argv[])
+{
+ printf("Hello, World!\n");
+ return EXIT_SUCCESS;
+}
--- /dev/null
+/*
+ * test_strutils.c - tests for strutils.c routines
+ * This file was copied from util-linux at fall 2011.
+ *
+ * Copyright (C) 2010 Karel Zak <kzak@redhat.com>
+ * Copyright (C) 2010 Davidlohr Bueso <dave@gnu.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <stdlib.h>
+
+#include "c.h"
+#include "strutils.h"
+
+int main(int argc, char *argv[])
+{
+ if (argc < 2) {
+ error(EXIT_FAILURE, 0, "no arguments");
+ } else if (argc < 3) {
+ printf("%ld\n", strtol_or_err(argv[1], "strtol_or_err"));
+ } else {
+ printf("%lf\n", strtod_or_err(argv[2], "strtod_or_err"));
+ }
+ return EXIT_SUCCESS;
+}