[PATCH 33/33] build system: rename tests so that they are all named test_*

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The uuid test was formerly tst_uuid, and the login-utils tests used
_test suffix rather than test_ prefix. Make sure that they have all
the same prefix so that they can be also ignored with a single line.

Signed-off-by: Diego Elio 'Flameeyes' Pettenò <flameeyes@xxxxxxxxx>
---
 .gitignore                  |    1 +
 login-utils/.gitignore      |    2 -
 login-utils/module.am       |   12 ++--
 po/POTFILES.in              |    2 +-
 shlibs/blkid/.gitignore     |    1 -
 shlibs/mount/.gitignore     |    1 -
 shlibs/uuid/.gitignore      |    1 -
 shlibs/uuid/module.am       |    6 +-
 shlibs/uuid/src/test_uuid.c |  180 +++++++++++++++++++++++++++++++++++++++++++
 shlibs/uuid/src/tst_uuid.c  |  180 -------------------------------------------
 tests/commands.sh.in        |    4 +-
 11 files changed, 193 insertions(+), 197 deletions(-)
 delete mode 100644 shlibs/uuid/.gitignore
 create mode 100644 shlibs/uuid/src/test_uuid.c
 delete mode 100644 shlibs/uuid/src/tst_uuid.c

diff --git a/.gitignore b/.gitignore
index bc71c2e..488479a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -37,6 +37,7 @@ tags
 .deps
 .libs
 .dirstamp
+test_*
 
 # libtool-2 stuff -- temporary added to repository (because libtool-2.x.x is
 #                    still not in avaialable in many Linux distributions)
diff --git a/login-utils/.gitignore b/login-utils/.gitignore
index 8c77183..d1811a4 100644
--- a/login-utils/.gitignore
+++ b/login-utils/.gitignore
@@ -1,5 +1,3 @@
-checktty_test
-islocal_test
 agetty
 wall
 chfn
diff --git a/login-utils/module.am b/login-utils/module.am
index 17c4603..cbdc5b9 100644
--- a/login-utils/module.am
+++ b/login-utils/module.am
@@ -134,9 +134,9 @@ INSTALL_EXEC_HOOKS += install-exec-hook-init
 INSTALL_DATA_HOOKS += install-data-hook-init
 endif
 
-check_PROGRAMS += login-utils/checktty_test login-utils/islocal_test
-login_utils_checktty_test_SOURCES = login-utils/checktty.c login-utils/login.h
-login_utils_checktty_test_CPPFLAGS = -DMAIN_TEST_CHECKTTY $(AM_CPPFLAGS)
-login_utils_islocal_test_SOURCES = login-utils/islocal.c
-login_utils_islocal_test_CPPFLAGS = -DMAIN_TEST_ISLOCAL $(AM_CPPFLAGS)
-login_utils_islocal_test_LDADD = lib/libcommon.la
+check_PROGRAMS += login-utils/test_checktty login-utils/test_islocal
+login_utils_test_checktty_SOURCES = login-utils/checktty.c login-utils/login.h
+login_utils_test_checktty_CPPFLAGS = -DMAIN_TEST_CHECKTTY $(AM_CPPFLAGS)
+login_utils_test_islocal_SOURCES = login-utils/islocal.c
+login_utils_test_islocal_CPPFLAGS = -DMAIN_TEST_ISLOCAL $(AM_CPPFLAGS)
+login_utils_test_islocal_LDADD = lib/libcommon.la
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 24644bb..61167f1 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -211,7 +211,7 @@ shlibs/uuid/src/gen_uuid_nt.c
 shlibs/uuid/src/isnull.c
 shlibs/uuid/src/pack.c
 shlibs/uuid/src/parse.c
-shlibs/uuid/src/tst_uuid.c
+shlibs/uuid/src/test_uuid.c
 shlibs/uuid/src/unpack.c
 shlibs/uuid/src/unparse.c
 shlibs/uuid/src/uuid_time.c
diff --git a/shlibs/blkid/.gitignore b/shlibs/blkid/.gitignore
index 6ffe4a9..9ce937e 100644
--- a/shlibs/blkid/.gitignore
+++ b/shlibs/blkid/.gitignore
@@ -1,5 +1,4 @@
 *.sh
 bin/blkid
 bin/findfs
-test_*
 blkid.h
diff --git a/shlibs/mount/.gitignore b/shlibs/mount/.gitignore
index 1c7879d..ac54737 100644
--- a/shlibs/mount/.gitignore
+++ b/shlibs/mount/.gitignore
@@ -1,2 +1 @@
-test_*
 mount.h
diff --git a/shlibs/uuid/.gitignore b/shlibs/uuid/.gitignore
deleted file mode 100644
index f85e972..0000000
--- a/shlibs/uuid/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-tst_*
diff --git a/shlibs/uuid/module.am b/shlibs/uuid/module.am
index 6354304..5f7e091 100644
--- a/shlibs/uuid/module.am
+++ b/shlibs/uuid/module.am
@@ -1,7 +1,7 @@
 AM_CPPFLAGS += -I$(ul_libuuid_srcdir)
 
-shlibs_uuid_src_tst_uuid_LDADD = shlibs/uuid/src/libuuid.la
-shlibs_uuid_src_tst_uuid_LDFLAGS = -static
+shlibs_uuid_src_test_uuid_LDADD = shlibs/uuid/src/libuuid.la
+shlibs_uuid_src_test_uuid_LDFLAGS = -static
 
 # includes
 uuidincdir = $(includedir)/uuid
@@ -25,7 +25,7 @@ EXTRA_DIST += shlibs/uuid/src/uuid.sym shlibs/uuid/src/gen_uuid_nt.c
 
 if BUILD_LIBUUID
 usrlib_exec_LTLIBRARIES += shlibs/uuid/src/libuuid.la
-check_PROGRAMS += shlibs/uuid/src/tst_uuid
+check_PROGRAMS += shlibs/uuid/src/test_uuid
 
 pkgconfig_DATA += shlibs/uuid/uuid.pc
 
diff --git a/shlibs/uuid/src/test_uuid.c b/shlibs/uuid/src/test_uuid.c
new file mode 100644
index 0000000..e03138f
--- /dev/null
+++ b/shlibs/uuid/src/test_uuid.c
@@ -0,0 +1,180 @@
+/*
+ * tst_uuid.c --- test program from the UUID library
+ *
+ * Copyright (C) 1996, 1997, 1998 Theodore Ts'o.
+ *
+ * %Begin-Header%
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, and the entire permission notice in its entirety,
+ *    including the disclaimer of warranties.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote
+ *    products derived from this software without specific prior
+ *    written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF
+ * WHICH ARE HEREBY DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ * %End-Header%
+ */
+
+#ifdef _WIN32
+#define _WIN32_WINNT 0x0500
+#include <windows.h>
+#define UUID MYUUID
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "uuid.h"
+
+static int test_uuid(const char * uuid, int isValid)
+{
+	static const char * validStr[2] = {"invalid", "valid"};
+	uuid_t uuidBits;
+	int parsedOk;
+
+	parsedOk = uuid_parse(uuid, uuidBits) == 0;
+
+	printf("%s is %s", uuid, validStr[isValid]);
+	if (parsedOk != isValid) {
+		printf(" but uuid_parse says %s\n", validStr[parsedOk]);
+		return 1;
+	}
+	printf(", OK\n");
+	return 0;
+}
+
+#ifdef __GNUC__
+#define ATTR(x) __attribute__(x)
+#else
+#define ATTR(x)
+#endif
+
+int
+main(int argc ATTR((unused)) , char **argv ATTR((unused)))
+{
+	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);
+	uuid_unparse(buf, str);
+	printf("UUID generate = %s\n", str);
+	printf("UUID: ");
+	for (i=0, cp = (unsigned char *) &buf; i < 16; i++) {
+		printf("%02x", *cp++);
+	}
+	printf("\n");
+	type = uuid_type(buf); 	variant = uuid_variant(buf);
+	printf("UUID type = %d, UUID variant = %d\n", type, variant);
+	if (variant != UUID_VARIANT_DCE) {
+		printf("Incorrect UUID Variant; was expecting DCE!\n");
+		failed++;
+	}
+	printf("\n");
+
+	uuid_generate_random(buf);
+	uuid_unparse(buf, str);
+	printf("UUID random string = %s\n", str);
+	printf("UUID: ");
+	for (i=0, cp = (unsigned char *) &buf; i < 16; i++) {
+		printf("%02x", *cp++);
+	}
+	printf("\n");
+	type = uuid_type(buf); 	variant = uuid_variant(buf);
+	printf("UUID type = %d, UUID variant = %d\n", type, variant);
+	if (variant != UUID_VARIANT_DCE) {
+		printf("Incorrect UUID Variant; was expecting DCE!\n");
+		failed++;
+	}
+	if (type != 4) {
+		printf("Incorrect UUID type; was expecting "
+		       "4 (random type)!\n");
+		failed++;
+	}
+	printf("\n");
+
+	uuid_generate_time(buf);
+	uuid_unparse(buf, str);
+	printf("UUID string = %s\n", str);
+	printf("UUID time: ");
+	for (i=0, cp = (unsigned char *) &buf; i < 16; i++) {
+		printf("%02x", *cp++);
+	}
+	printf("\n");
+	type = uuid_type(buf); 	variant = uuid_variant(buf);
+	printf("UUID type = %d, UUID variant = %d\n", type, variant);
+	if (variant != UUID_VARIANT_DCE) {
+		printf("Incorrect UUID Variant; was expecting DCE!\n");
+		failed++;
+	}
+	if (type != 1) {
+		printf("Incorrect UUID type; was expecting "
+		       "1 (time-based type)!\\n");
+		failed++;
+	}
+	tv.tv_sec = 0;
+	tv.tv_usec = 0;
+	time_reg = uuid_time(buf, &tv);
+	printf("UUID time is: (%ld, %ld): %s\n", tv.tv_sec, tv.tv_usec,
+	       ctime(&time_reg));
+	uuid_parse(str, tst);
+	if (!uuid_compare(buf, tst))
+		printf("UUID parse and compare succeeded.\n");
+	else {
+		printf("UUID parse and compare failed!\n");
+		failed++;
+	}
+	uuid_clear(tst);
+	if (uuid_is_null(tst))
+		printf("UUID clear and is null succeeded.\n");
+	else {
+		printf("UUID clear and is null failed!\n");
+		failed++;
+	}
+	uuid_copy(buf, tst);
+	if (!uuid_compare(buf, tst))
+		printf("UUID copy and compare succeeded.\n");
+	else {
+		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);
+	failed += test_uuid("84949cc5-4701-4a84-895b-354c584a981", 0);
+	failed += test_uuid("84949cc5x4701-4a84-895b-354c584a981b", 0);
+	failed += test_uuid("84949cc504701-4a84-895b-354c584a981b", 0);
+	failed += test_uuid("84949cc5-470104a84-895b-354c584a981b", 0);
+	failed += test_uuid("84949cc5-4701-4a840895b-354c584a981b", 0);
+	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);
+
+	if (failed) {
+		printf("%d failures.\n", failed);
+		exit(1);
+	}
+	return 0;
+}
diff --git a/shlibs/uuid/src/tst_uuid.c b/shlibs/uuid/src/tst_uuid.c
deleted file mode 100644
index e03138f..0000000
--- a/shlibs/uuid/src/tst_uuid.c
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * tst_uuid.c --- test program from the UUID library
- *
- * Copyright (C) 1996, 1997, 1998 Theodore Ts'o.
- *
- * %Begin-Header%
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, and the entire permission notice in its entirety,
- *    including the disclaimer of warranties.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote
- *    products derived from this software without specific prior
- *    written permission.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF
- * WHICH ARE HEREBY DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
- * USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- * %End-Header%
- */
-
-#ifdef _WIN32
-#define _WIN32_WINNT 0x0500
-#include <windows.h>
-#define UUID MYUUID
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "uuid.h"
-
-static int test_uuid(const char * uuid, int isValid)
-{
-	static const char * validStr[2] = {"invalid", "valid"};
-	uuid_t uuidBits;
-	int parsedOk;
-
-	parsedOk = uuid_parse(uuid, uuidBits) == 0;
-
-	printf("%s is %s", uuid, validStr[isValid]);
-	if (parsedOk != isValid) {
-		printf(" but uuid_parse says %s\n", validStr[parsedOk]);
-		return 1;
-	}
-	printf(", OK\n");
-	return 0;
-}
-
-#ifdef __GNUC__
-#define ATTR(x) __attribute__(x)
-#else
-#define ATTR(x)
-#endif
-
-int
-main(int argc ATTR((unused)) , char **argv ATTR((unused)))
-{
-	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);
-	uuid_unparse(buf, str);
-	printf("UUID generate = %s\n", str);
-	printf("UUID: ");
-	for (i=0, cp = (unsigned char *) &buf; i < 16; i++) {
-		printf("%02x", *cp++);
-	}
-	printf("\n");
-	type = uuid_type(buf); 	variant = uuid_variant(buf);
-	printf("UUID type = %d, UUID variant = %d\n", type, variant);
-	if (variant != UUID_VARIANT_DCE) {
-		printf("Incorrect UUID Variant; was expecting DCE!\n");
-		failed++;
-	}
-	printf("\n");
-
-	uuid_generate_random(buf);
-	uuid_unparse(buf, str);
-	printf("UUID random string = %s\n", str);
-	printf("UUID: ");
-	for (i=0, cp = (unsigned char *) &buf; i < 16; i++) {
-		printf("%02x", *cp++);
-	}
-	printf("\n");
-	type = uuid_type(buf); 	variant = uuid_variant(buf);
-	printf("UUID type = %d, UUID variant = %d\n", type, variant);
-	if (variant != UUID_VARIANT_DCE) {
-		printf("Incorrect UUID Variant; was expecting DCE!\n");
-		failed++;
-	}
-	if (type != 4) {
-		printf("Incorrect UUID type; was expecting "
-		       "4 (random type)!\n");
-		failed++;
-	}
-	printf("\n");
-
-	uuid_generate_time(buf);
-	uuid_unparse(buf, str);
-	printf("UUID string = %s\n", str);
-	printf("UUID time: ");
-	for (i=0, cp = (unsigned char *) &buf; i < 16; i++) {
-		printf("%02x", *cp++);
-	}
-	printf("\n");
-	type = uuid_type(buf); 	variant = uuid_variant(buf);
-	printf("UUID type = %d, UUID variant = %d\n", type, variant);
-	if (variant != UUID_VARIANT_DCE) {
-		printf("Incorrect UUID Variant; was expecting DCE!\n");
-		failed++;
-	}
-	if (type != 1) {
-		printf("Incorrect UUID type; was expecting "
-		       "1 (time-based type)!\\n");
-		failed++;
-	}
-	tv.tv_sec = 0;
-	tv.tv_usec = 0;
-	time_reg = uuid_time(buf, &tv);
-	printf("UUID time is: (%ld, %ld): %s\n", tv.tv_sec, tv.tv_usec,
-	       ctime(&time_reg));
-	uuid_parse(str, tst);
-	if (!uuid_compare(buf, tst))
-		printf("UUID parse and compare succeeded.\n");
-	else {
-		printf("UUID parse and compare failed!\n");
-		failed++;
-	}
-	uuid_clear(tst);
-	if (uuid_is_null(tst))
-		printf("UUID clear and is null succeeded.\n");
-	else {
-		printf("UUID clear and is null failed!\n");
-		failed++;
-	}
-	uuid_copy(buf, tst);
-	if (!uuid_compare(buf, tst))
-		printf("UUID copy and compare succeeded.\n");
-	else {
-		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);
-	failed += test_uuid("84949cc5-4701-4a84-895b-354c584a981", 0);
-	failed += test_uuid("84949cc5x4701-4a84-895b-354c584a981b", 0);
-	failed += test_uuid("84949cc504701-4a84-895b-354c584a981b", 0);
-	failed += test_uuid("84949cc5-470104a84-895b-354c584a981b", 0);
-	failed += test_uuid("84949cc5-4701-4a840895b-354c584a981b", 0);
-	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);
-
-	if (failed) {
-		printf("%d failures.\n", failed);
-		exit(1);
-	}
-	return 0;
-}
diff --git a/tests/commands.sh.in b/tests/commands.sh.in
index 94f6521..7350297 100644
--- a/tests/commands.sh.in
+++ b/tests/commands.sh.in
@@ -42,8 +42,8 @@ TS_CMD_LOOK=${TS_CMD_LOOK-"$TOPDIR/misc-utils/look"}
 TS_CMD_CAL=${TS_CMD_CAL-"$TOPDIR/misc-utils/cal"}
 TS_CMD_SCRIPT=${TS_CMD_SCRIPT-"$TOPDIR/misc-utils/script"}
 
-TS_CMD_CHECKTTY=${TS_CMD_CHECKTTY-"$TOPDIR/login-utils/checktty_test"}
-TS_CMD_ISLOCAL=${TS_CMD_ISLOCAL-"$TOPDIR/login-utils/islocal_test"}
+TS_CMD_CHECKTTY=${TS_CMD_CHECKTTY-"$TOPDIR/login-utils/test_checktty"}
+TS_CMD_ISLOCAL=${TS_CMD_ISLOCAL-"$TOPDIR/login-utils/test_islocal"}
 
 TS_CMD_HWCLOCK=${TS_CMD_HWCLOCK-"$TOPDIR/hwclock/hwclock"}
 TS_CMD_LSCPU=${TS_CMD_LSCPU-"$TOPDIR/sys-utils/lscpu"}
-- 
1.7.1.1

--
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux