[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
filenamecat-tests & fstrcmp-tests: needs program_name symbol
From: |
Simon Josefsson |
Subject: |
filenamecat-tests & fstrcmp-tests: needs program_name symbol |
Date: |
Sun, 18 Jan 2009 17:26:19 +0100 |
User-agent: |
Gnus/5.110011 (No Gnus v0.11) Emacs/23.0.60 (gnu/linux) |
The self-test for filenamecat fails to build on darwin:
http://autobuild.josefsson.org/gnulib/log-200901180512377089000.txt
Which also breaks the canonicalize module:
http://autobuild.josefsson.org/gnulib/log-200901180511842725000.txt
The fstrcmp-tests has the same problem:
http://autobuild.josefsson.org/gnulib/log-200901180513160251000.txt
The problem is that the filenamecat.c and fstrcmp.c implementations uses
xalloc, which uses error, which requires a program_name symbol, and the
self-tests doesn't provide one.
How about the patch below? Tested on debian lenny x86 and mac os x
10.4.
/Simon
diff --git a/ChangeLog b/ChangeLog
index d9b6b25..64736b1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2009-01-18 Simon Josefsson <address@hidden>
+
+ * modules/filenamecat-tests (Depends-on): Add progname.
+ * modules/fstrcmp-tests (Depends-on): Likewise.
+
+ * tests/test-filenamecat.c: Use progname module, to avoid link
+ errors on non-glibc systems.
+ * tests/test-fstrcmp.c: Likewise.
+
2009-01-18 Bruno Haible <address@hidden>
New module 'alphasort'.
diff --git a/modules/filenamecat-tests b/modules/filenamecat-tests
index 14d3c17..93ccac1 100644
--- a/modules/filenamecat-tests
+++ b/modules/filenamecat-tests
@@ -3,6 +3,7 @@ tests/test-filenamecat.c
Depends-on:
stdbool
+progname
configure.ac:
diff --git a/modules/fstrcmp-tests b/modules/fstrcmp-tests
index cb9eff5..c7dcda5 100644
--- a/modules/fstrcmp-tests
+++ b/modules/fstrcmp-tests
@@ -3,6 +3,7 @@ tests/test-fstrcmp.c
Depends-on:
stdbool
+progname
configure.ac:
diff --git a/tests/test-filenamecat.c b/tests/test-filenamecat.c
index 879a186..d102ef6 100644
--- a/tests/test-filenamecat.c
+++ b/tests/test-filenamecat.c
@@ -1,6 +1,6 @@
/* Test of concatenation of two arbitrary file names.
- Copyright (C) 1996-2007 Free Software Foundation, Inc.
+ Copyright (C) 1996-2007, 2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -26,8 +26,10 @@
#include <stdlib.h>
#include <string.h>
+#include "progname.h"
+
int
-main ()
+main (int argc, char *argv[])
{
static char const *const tests[][3] =
{
@@ -46,6 +48,9 @@ main ()
};
unsigned int i;
bool fail = false;
+
+ set_program_name (argv[0]);
+
for (i = 0; i < sizeof tests / sizeof tests[0]; i++)
{
char *base_in_result;
diff --git a/tests/test-fstrcmp.c b/tests/test-fstrcmp.c
index b266b59..6984550 100644
--- a/tests/test-fstrcmp.c
+++ b/tests/test-fstrcmp.c
@@ -1,5 +1,5 @@
/* Test of fuzzy string comparison.
- Copyright (C) 2007-2008 Free Software Foundation, Inc.
+ Copyright (C) 2007-2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -24,6 +24,8 @@
#include <stdio.h>
#include <stdlib.h>
+#include "progname.h"
+
#define ASSERT(expr) \
do \
{ \
@@ -75,8 +77,10 @@ check_fstrcmp (const char *string1, const char *string2,
double expected)
}
int
-main ()
+main (int argc, char *argv[])
{
+ set_program_name (argv[0]);
+
ASSERT (check_fstrcmp ("Langstrumpf", "Langstrumpf", 1.0));
ASSERT (check_fstrcmp ("Levenshtein", "Levenstein", 20./21.));
ASSERT (check_fstrcmp ("Levenstein", "Levenshtein", 20./21.));
- filenamecat-tests & fstrcmp-tests: needs program_name symbol,
Simon Josefsson <=