]> err.no Git - util-linux/commitdiff
libmount: add test_version
authorKarel Zak <kzak@redhat.com>
Fri, 27 Nov 2009 00:13:01 +0000 (01:13 +0100)
committerKarel Zak <kzak@redhat.com>
Thu, 3 Jun 2010 13:20:10 +0000 (15:20 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
shlibs/mount/src/Makefile.am
shlibs/mount/src/version.c

index 0483367a3dc26409200c32498049eac79ecd2342..f9cc68f939dff35a0482a45e264e3dc04040592c 100644 (file)
@@ -20,7 +20,7 @@ libmount_la_DEPENDENCIES = $(libmount_la_LIBADD) mount.sym mount.h.in
 libmount_la_LDFLAGS = -Wl,--version-script=$(ul_libmount_srcdir)/mount.sym \
                       -version-info $(LIBMOUNT_VERSION_INFO)
 
-tests =
+tests = test_version
 
 EXTRA_DIST = mount.sym mount.h.in
 CLEANFILES = $(tests)
index 8fd38a3c54d5a8325494311d182842dec2c97aad..0380e1c28622d4ab146057d9989f53994070dee5 100644 (file)
@@ -50,3 +50,31 @@ int mnt_get_library_version(const char **ver_string)
 
        return mnt_parse_version_string(lib_version);
 }
+
+#ifdef TEST_PROGRAM
+int test_version(struct mtest *ts, int argc, char *argv[])
+{
+       const char *ver;
+
+       mnt_get_library_version(&ver);
+
+       printf("Library version: %s\n", ver);
+       printf("Library API version: " LIBMOUNT_VERSION "\n");
+
+       if (mnt_get_library_version(NULL) ==
+                       mnt_parse_version_string(LIBMOUNT_VERSION))
+               return 0;
+
+       return -1;
+}
+
+int main(int argc, char *argv[])
+{
+       struct mtest ts[] = {
+               { "--print", test_version, "print versions" },
+               { NULL }
+       };
+
+       return mnt_run_test(ts, argc, argv);
+}
+#endif