]> err.no Git - util-linux/commitdiff
lib: add test program to canonicalize.c
authorKarel Zak <kzak@redhat.com>
Fri, 22 Oct 2010 21:38:07 +0000 (23:38 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 25 Oct 2010 09:00:15 +0000 (11:00 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
lib/Makefile.am
lib/canonicalize.c

index 2a185f3439d28047b269b87b1784cd881f20f371..45d319d34a1008ff75143d917fb4d0543a1c4e47 100644 (file)
@@ -3,7 +3,7 @@ include $(top_srcdir)/config/include-Makefile.am
 AM_CPPFLAGS += -DTEST_PROGRAM
 
 noinst_PROGRAMS = test_blkdev test_ismounted test_wholedisk test_mangle \
-                 test_strtosize test_tt
+                 test_strtosize test_tt test_canonicalize
 if LINUX
 if HAVE_CPU_SET_T
 noinst_PROGRAMS += test_cpuset
@@ -19,6 +19,7 @@ if LINUX
 test_cpuset_SOURCES = cpuset.c
 endif
 test_tt_SOURCES = tt.c
+test_canonicalize_SOURCES = canonicalize.c
 
 if LINUX
 test_blkdev_SOURCES += linux_version.c
index 29b3f2592a5f3c58b378bcca9eb322b32a0bd44f..1449851fedb566a2547d2cfb9c3d1cb63d3e7af4 100644 (file)
@@ -189,3 +189,17 @@ canonicalize_path(const char *path)
 }
 
 
+#ifdef TEST_PROGRAM
+int main(int argc, char **argv)
+{
+       if (argc < 2) {
+               fprintf(stderr, "usage: %s <device>\n", argv[0]);
+               exit(EXIT_FAILURE);
+       }
+
+       fprintf(stdout, "orig: %s\n", argv[1]);
+       fprintf(stdout, "real: %s\n", canonicalize_path(argv[1]));
+
+       exit(EXIT_SUCCESS);
+}
+#endif