1 AT_BANNER([UUID unit tests])
3 m4_define([UUID_REGEX],
4 [[[0-9a-f]\{8\}-[0-9a-f]\{4\}-4[0-9a-f]\{3\}-[89ab][0-9a-f]\{3\}-[0-9a-f]\{12\}$]])
6 m4_define([CHECK_UUID],
7 [if expr "$uuid" : 'UUID_REGEX' > /dev/null
11 echo "$uuid: not a random UUID"
15 # This test is a strict subset of the larger test down below, but it
16 # allows us to get test coverage data via OVS_CHECK_LCOV.
17 AT_SETUP([UUID generation])
19 OVS_CHECK_LCOV([test-uuid > uuid])
25 # This test is a strict subset of the larger test down below, but it
26 # allows us to get test coverage data via OVS_CHECK_LCOV.
27 AT_SETUP([UUID parsing and serialization])
29 OVS_CHECK_LCOV([test-uuid f47ac10b-58cc-4372-a567-0e02b2c3d479], [0],
30 [f47ac10b-58cc-4372-a567-0e02b2c3d479
34 AT_SETUP([UUID generation, parsing, serialization])
38 for i in m4_for([count], [1], [100], [1], [count ]); do
39 # Generate random UUID and check that it is in the expected format.
43 # Verify that $uuid does not duplicate any UUID generated so far.
46 echo "$uuid: generated duplicate UUID"
51 # Verify that test-uuid parses and re-serializes this UUID correctly.
52 serialized=`test-uuid $uuid`
53 if test "$uuid" != "$serialized"; then
54 echo "$uuid: test-uuid serialized this as $serialized"