tests: don't consider "make check" a compiler error

In a number of places, the output format from "make check" is
incorrectly interpreted as compiler warning output (triggered by
the presence of colons and parenthesis in the output).  Convert
these lines to similar output that does not trigger false build
warnings.

In the case of the tst_uuid.c program, the "ctime()" output was
difficult to change, but in fact it is better to actually compare
the time-based UUID against wallclock time instead of just printing
the formatted time as a string, so this test is improved.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
This commit is contained in:
Andreas Dilger 2012-11-29 05:47:51 -07:00 committed by Theodore Ts'o
parent 831f309c62
commit f797cf3e37
3 changed files with 25 additions and 10 deletions

View File

@ -166,7 +166,7 @@ void print_csum(const char *msg, ext2_filsys fs, dgrp_t group)
{
__u16 crc1, crc2, crc3;
dgrp_t swabgroup;
struct ext2_group_desc *desc = ext2fs_group_desc(fs, fs->group_desc, group);
struct ext2_group_desc *desc;
size_t size;
struct ext2_super_block *sb = fs->super;
int offset = offsetof(struct ext2_group_desc, bg_checksum);
@ -174,6 +174,7 @@ void print_csum(const char *msg, ext2_filsys fs, dgrp_t group)
struct ext4_group_desc swabdesc;
#endif
desc = ext2fs_group_desc(fs, fs->group_desc, group);
size = fs->super->s_desc_size;
if (size < EXT2_MIN_DESC_SIZE)
size = EXT2_MIN_DESC_SIZE;
@ -198,7 +199,7 @@ void print_csum(const char *msg, ext2_filsys fs, dgrp_t group)
if (offset < size)
crc3 = ext2fs_crc16(crc3, (char *)desc + offset, size - offset);
printf("%s: UUID %s(%04x), grp %u(%04x): %04x=%04x\n",
printf("%s UUID %s=%04x, grp %u=%04x: %04x=%04x\n",
msg, e2p_uuid2str(sb->s_uuid), crc1, group, crc2, crc3,
ext2fs_group_desc_csum(fs, group));
}

View File

@ -99,7 +99,7 @@ static errcode_t test_memalign(unsigned long align)
if (!retval && !isaligned(ptr, align))
retval = EINVAL;
free(ptr);
printf("tst_memliagn(%lu): %s\n", align,
printf("tst_memalign(%lu) is %s\n", align,
retval ? error_message(retval) : "OK");
return retval;
}

View File

@ -74,7 +74,7 @@ main(int argc ATTR((unused)) , char **argv ATTR((unused)))
uuid_t buf, tst;
char str[100];
struct timeval tv;
time_t time_reg;
time_t time_reg, time_gen;
unsigned char *cp;
int i;
int failed = 0;
@ -104,7 +104,8 @@ main(int argc ATTR((unused)) , char **argv ATTR((unused)))
printf("%02x", *cp++);
}
printf("\n");
type = uuid_type(buf); variant = uuid_variant(buf);
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");
@ -117,6 +118,7 @@ main(int argc ATTR((unused)) , char **argv ATTR((unused)))
}
printf("\n");
time_gen = time(0);
uuid_generate_time(buf);
uuid_unparse(buf, str);
printf("UUID string = %s\n", str);
@ -125,7 +127,8 @@ main(int argc ATTR((unused)) , char **argv ATTR((unused)))
printf("%02x", *cp++);
}
printf("\n");
type = uuid_type(buf); variant = uuid_variant(buf);
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");
@ -136,15 +139,25 @@ main(int argc ATTR((unused)) , char **argv ATTR((unused)))
"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));
printf("UUID generated at %lu reports %lu (%ld.%ld)\n",
time_gen, time_reg, tv.tv_sec, tv.tv_usec);
/* allow 1s margin in case of rollover between sampling
* the current time and when the UUID is generated. */
if (time_reg > time_gen + 1) {
printf("UUID time comparison failed!\n");
failed++;
} else {
printf("UUID time comparison succeeded.\n");
}
uuid_parse(str, tst);
if (!uuid_compare(buf, tst))
if (!uuid_compare(buf, tst)) {
printf("UUID parse and compare succeeded.\n");
else {
} else {
printf("UUID parse and compare failed!\n");
failed++;
}
@ -162,6 +175,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);