mirror of
https://github.com/openvswitch/ovs
synced 2025-10-29 15:28:56 +00:00
Improve link speed by linking 29 test programs into ovstest. On my machine, running the following command against a fully built tree: $ touch lib/random.c; time make Improve the overall build time from 7 seconds to 3.5 seconds. Signed-off-by: Andy Zhou <azhou@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
40 lines
1.0 KiB
Plaintext
40 lines
1.0 KiB
Plaintext
AT_BANNER([UUID unit tests])
|
|
|
|
m4_define([UUID_REGEX],
|
|
[[[0-9a-f]\{8\}-[0-9a-f]\{4\}-4[0-9a-f]\{3\}-[89ab][0-9a-f]\{3\}-[0-9a-f]\{12\}$]])
|
|
|
|
m4_define([CHECK_UUID],
|
|
[if expr "$uuid" : 'UUID_REGEX' > /dev/null
|
|
then
|
|
:
|
|
else
|
|
echo "$uuid: not a random UUID"
|
|
exit 1
|
|
fi])
|
|
|
|
AT_SETUP([UUID generation, parsing, serialization])
|
|
AT_KEYWORDS([UUID])
|
|
AT_CHECK([
|
|
uuids=
|
|
for i in m4_for([count], [1], [100], [1], [count ]); do
|
|
# Generate random UUID and check that it is in the expected format.
|
|
uuid=`ovstest test-uuid`
|
|
CHECK_UUID
|
|
|
|
# Verify that $uuid does not duplicate any UUID generated so far.
|
|
case $uuids in
|
|
*$uuid*)
|
|
echo "$uuid: generated duplicate UUID"
|
|
exit 1
|
|
esac
|
|
uuids="$uuids $uuid"
|
|
|
|
# Verify that test-uuid parses and re-serializes this UUID correctly.
|
|
serialized=`ovstest test-uuid $uuid`
|
|
if test "$uuid" != "$serialized"; then
|
|
echo "$uuid: test-uuid serialized this as $serialized"
|
|
exit 1
|
|
fi
|
|
done], [0])
|
|
AT_CLEANUP
|