diff options
author | Sami Kerola | 2015-10-18 19:39:21 +0200 |
---|---|---|
committer | Sami Kerola | 2015-10-18 19:39:21 +0200 |
commit | 4d3f964e4a5eecdfd17724f03696890bf22d4a3d (patch) | |
tree | 0cccccc5184f5c871bb9d39c9f937830e1a70fc8 /libuuid | |
parent | script: be pedantic and use "%"SCNi64 (diff) | |
download | kernel-qcow2-util-linux-4d3f964e4a5eecdfd17724f03696890bf22d4a3d.tar.gz kernel-qcow2-util-linux-4d3f964e4a5eecdfd17724f03696890bf22d4a3d.tar.xz kernel-qcow2-util-linux-4d3f964e4a5eecdfd17724f03696890bf22d4a3d.zip |
tests: add uuid parser check
The check is based on code by Theodore Ts'o to test libuuid, from which
unstable output is commented out.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'libuuid')
-rw-r--r-- | libuuid/src/Makemodule.am | 8 | ||||
-rw-r--r-- | libuuid/src/test_uuid.c | 8 |
2 files changed, 11 insertions, 5 deletions
diff --git a/libuuid/src/Makemodule.am b/libuuid/src/Makemodule.am index 061aff21d..180ac01c0 100644 --- a/libuuid/src/Makemodule.am +++ b/libuuid/src/Makemodule.am @@ -1,8 +1,8 @@ -check_PROGRAMS += test_uuid -test_uuid_SOURCES = libuuid/src/test_uuid.c -test_uuid_LDADD = libuuid.la $(SOCKET_LIBS) -test_uuid_CFLAGS = -I$(ul_libuuid_incdir) +check_PROGRAMS += test_uuid_parser +test_uuid_parser_SOURCES = libuuid/src/test_uuid.c +test_uuid_parser_LDADD = libuuid.la $(SOCKET_LIBS) +test_uuid_parser_CFLAGS = -I$(ul_libuuid_incdir) # includes uuidincdir = $(includedir)/uuid diff --git a/libuuid/src/test_uuid.c b/libuuid/src/test_uuid.c index e03138f7d..e8f070317 100644 --- a/libuuid/src/test_uuid.c +++ b/libuuid/src/test_uuid.c @@ -69,13 +69,15 @@ static int test_uuid(const char * uuid, int isValid) int main(int argc ATTR((unused)) , char **argv ATTR((unused))) { + int failed = 0; +/* Code commented out will print random uuid's that are unsuitable output + * for test suite. uuid_t buf, tst; char str[100]; struct timeval tv; time_t time_reg; unsigned char *cp; int i; - int failed = 0; int type, variant; uuid_generate(buf); @@ -160,6 +162,7 @@ main(int argc ATTR((unused)) , char **argv ATTR((unused))) printf("UUID copy and compare failed!\n"); failed++; } +*/ failed += test_uuid("84949cc5-4701-4a84-895b-354c584a981b", 1); failed += test_uuid("84949CC5-4701-4A84-895B-354C584A981B", 1); failed += test_uuid("84949cc5-4701-4a84-895b-354c584a981bc", 0); @@ -171,6 +174,9 @@ main(int argc ATTR((unused)) , char **argv ATTR((unused))) failed += test_uuid("84949cc5-4701-4a84-895b0354c584a981b", 0); failed += test_uuid("g4949cc5-4701-4a84-895b-354c584a981b", 0); failed += test_uuid("84949cc5-4701-4a84-895b-354c584a981g", 0); + failed += test_uuid("00000000-0000-0000-0000-000000000000", 1); + failed += test_uuid("01234567-89ab-cdef-0134-567890abcedf", 1); + failed += test_uuid("ffffffff-ffff-ffff-ffff-ffffffffffff", 1); if (failed) { printf("%d failures.\n", failed); |