'''.split()
predefined_c = files('src/predefined.c')
+pack_c = files('src/pack.c')
unpack_c = files('src/unpack.c')
unparse_c = files('src/unparse.c')
meson.override_dependency('uuid', uuid_dep)
endif
endif
+
+test_uuid_time_sources = files('src/gen_uuid.c') + [
+ pack_c,
+ unpack_c,
+ randutils_c,
+ md5_c,
+ sha1_c,
+]
test_uuid_parser_LDADD = libuuid.la $(SOCKET_LIBS) $(LDADD)
test_uuid_parser_CFLAGS = $(AM_CFLAGS) -I$(ul_libuuid_incdir)
+check_PROGRAMS += test_uuid_time
+test_uuid_time_SOURCES = libuuid/src/gen_uuid.c \
+ libuuid/src/pack.c libuuid/src/unpack.c lib/randutils.c lib/md5.c lib/sha1.c
+test_uuid_time_LDADD = libuuid.la $(SOCKET_LIBS) $(LDADD)
+test_uuid_time_CFLAGS = $(AM_CFLAGS) -I$(ul_libuuid_incdir) -DTEST_PROGRAM
+
# includes
uuidincdir = $(includedir)/uuid
uuidinc_HEADERS = libuuid/src/uuid.h
}
#endif
+#ifdef TEST_PROGRAM
+#define gettimeofday gettimeofday_fixed
+
+static int gettimeofday_fixed(struct timeval *tv, void *tz __attribute__((unused)))
+{
+ tv->tv_sec = 1645557742;
+ tv->tv_usec = 123456;
+ return 0;
+}
+#endif
+
/*
* Get the ethernet hardware address, if we can find it...
*
return -1;
}
-#if defined(HAVE_UUIDD) && defined(HAVE_SYS_UN_H)
+#if defined(HAVE_UUIDD) && defined(HAVE_SYS_UN_H) && !defined(TEST_PROGRAM)
/*
* Try using the uuidd daemon to generate the UUID
uu.time_hi_and_version = (uu.time_hi_and_version & 0x0FFF) | 0x5000;
uuid_pack(&uu, out);
}
+
+#ifdef TEST_PROGRAM
+int main(void)
+{
+ char buf[UUID_STR_LEN];
+ uuid_t uuid;
+
+ uuid_generate_time(uuid);
+ uuid_unparse(uuid, buf);
+ printf("%s\n", buf);
+
+ uuid_generate_time_v6(uuid);
+ uuid_unparse(uuid, buf);
+ printf("%s\n", buf);
+
+ uuid_generate_time_v7(uuid);
+ uuid_unparse(uuid, buf);
+ printf("%s\n", buf);
+
+ return 0;
+}
+#endif
exes += exe
endif
+exe = executable(
+ 'test_uuid_time',
+ test_uuid_time_sources,
+ include_directories : [dir_include],
+ link_with : lib_uuid,
+ c_args : '-DTEST_PROGRAM',
+ build_by_default : program_tests)
+if not is_disabler(exe)
+ exes += exe
+endif
+
############################################################
libfdisk_tests_cflags = ['-DTEST_PROGRAM']
TS_HELPER_TIOCSTI="${ts_helpersdir}test_tiocsti"
TS_HELPER_UUID_PARSER="${ts_helpersdir}test_uuid_parser"
TS_HELPER_UUID_NAMESPACE="${ts_helpersdir}test_uuid_namespace"
+TS_HELPER_UUID_TIME="${ts_helpersdir}test_uuid_time"
TS_HELPER_MBSENCODE="${ts_helpersdir}test_mbsencode"
TS_HELPER_CAL="${ts_helpersdir}test_cal"
TS_HELPER_LAST_FUZZ="${ts_helpersdir}test_last_fuzz"
--- /dev/null
+VARIANT TYPE TIME
+DCE time-based 2022-02-22 19:22:22,123456+00:00
+DCE time-v6 2022-02-22 19:22:22,123456+00:00
+DCE time-v7 2022-02-22 19:22:22,123000+00:00
--- /dev/null
+#!/bin/bash
+
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+TS_TOPDIR="${0%/*}/../.."
+TS_DESC="uuid_time"
+
+. "$TS_TOPDIR"/functions.sh
+ts_init "$*"
+
+ts_check_test_command "$TS_HELPER_UUID_TIME"
+ts_check_test_command "$TS_CMD_UUIDPARSE"
+
+$TS_HELPER_UUID_TIME | TZ=UTC $TS_CMD_UUIDPARSE -o VARIANT,TYPE,TIME \
+ >> $TS_OUTPUT 2>> $TS_ERRLOG
+
+ts_finalize