[PATCH] Re: Testsuite races
Jeff Law
law@redhat.com
Fri Aug 17 17:09:00 GMT 2012
On 08/15/2012 12:55 PM, Roland McGrath wrote:
>> It looks like it's just tst-codeset, tst-gettext3 and tst-gettext5 which
>> conflict on ${objpfx}domaindir/de_DE/LC_MESSAGES/codeset.mo
>>
>> Changing the .sh file to look like:
>>
>> (
>> flock 200
>> [ generate data & run test ]
>> ) 200>${objpfx}lockfile
>>
>> In each of the three tests seems to do the trick. Similarly creating a
>> dependency in the Makefile where tst-gettext3.out depends on
>> tst-codeset.out and tst-gettext5.out depends on tst-gettext3.out works
>> just as well.
>
> The right answer is to have makefile rules to generate .../codeset.mo
> and have each of those .out targets depend on the file directly.
>
> With that, it looks like these tests won't need shell script wrappers at
> all, just the vanilla pattern rule should dtrt.
OK. Here's a patch which implements that approach. This is my first
twiddle to glibc's build machinery, so if I've goof'd something it's
purely from inexperience.
I've confirmed that after these changes we're using the vanilla pattern
rule with a proper environment passed to the test program. I've also
run the intl/ tests repeatedly in a make -j loop for considerable time
periods without seeing spurious failures.
-------------- next part --------------
2012-08-17 Jeff Law <law@redhat.com>
* intl/Makefile (.../codeset.mo): New Makefile target.
(tst-codeset.out): Depend on .../codeset.mo. Remove explicit rule.
(tst-gettext3.out, tst-gettext5.out): Likewise.
(tst-codeset-ENV): Define
(tst-gettext3-ENV, tst-gettext5-ENV): Likewise.
(tst-codeset.sh): Remove.
(tst-gettext3.sh, tst-gettext5.sh): Likewise.
diff --git a/intl/Makefile b/intl/Makefile
index e95f519..dd08e605 100644
--- a/intl/Makefile
+++ b/intl/Makefile
@@ -61,6 +61,14 @@ ifneq (no,$(PERL))
tests: $(objpfx)mtrace-tst-gettext
endif
endif
+
+# Multiple tests use this data. Create it once to avoid racing and
+# spurious test failures.
+$(objpfx)domaindir/de_DE/LC_MESSAGES/codeset.mo:
+ msgfmt -o ${objpfx}codeset.mo.$$ tstcodeset.po || exit
+ mkdir -p ${objpfx}domaindir/de_DE/LC_MESSAGES
+ mv -f ${objpfx}codeset.mo.$$ $@
+
$(objpfx)mtrace-tst-gettext: $(objpfx)tst-gettext.out
$(common-objpfx)malloc/mtrace $(objpfx)tst-gettext.mtrace > $@
$(objpfx)tst-gettext.out: tst-gettext.sh $(objpfx)tst-gettext
@@ -70,16 +78,14 @@ $(objpfx)tst-translit.out: tst-translit.sh $(objpfx)tst-translit
$(SHELL) -e $< $(common-objpfx) $(common-objpfx)intl/
$(objpfx)tst-gettext2.out: tst-gettext2.sh $(objpfx)tst-gettext2
$(SHELL) -e $< $(common-objpfx) $(common-objpfx)intl/
-$(objpfx)tst-codeset.out: tst-codeset.sh $(objpfx)tst-codeset
- $(SHELL) -e $< $(common-objpfx) $(common-objpfx)intl/
-$(objpfx)tst-gettext3.out: tst-gettext3.sh $(objpfx)tst-gettext3
- $(SHELL) -e $< $(common-objpfx) $(common-objpfx)intl/
$(objpfx)tst-gettext4.out: tst-gettext4.sh $(objpfx)tst-gettext4
$(SHELL) -e $< $(common-objpfx) '$(run-program-prefix)' $(common-objpfx)intl/
-$(objpfx)tst-gettext5.out: tst-gettext5.sh $(objpfx)tst-gettext5
- $(SHELL) -e $< $(common-objpfx) '$(run-program-prefix)' $(common-objpfx)intl/
$(objpfx)tst-gettext6.out: tst-gettext6.sh $(objpfx)tst-gettext6
$(SHELL) -e $< $(common-objpfx) '$(run-program-prefix)' $(common-objpfx)intl/
+
+$(objpfx)tst-codeset.out: $(objpfx)tst-codeset $(objpfx)domaindir/de_DE/LC_MESSAGES/codeset.mo
+$(objpfx)tst-gettext3.out: $(objpfx)tst-gettext3 $(objpfx)domaindir/de_DE/LC_MESSAGES/codeset.mo
+$(objpfx)tst-gettext5.out: $(objpfx)tst-gettext5 $(objpfx)domaindir/de_DE/LC_MESSAGES/codeset.mo
endif
endif
@@ -96,6 +102,10 @@ CFLAGS-tst-gettext4.c = -DOBJPFX=\"$(objpfx)\"
CFLAGS-tst-gettext5.c = -DOBJPFX=\"$(objpfx)\"
CFLAGS-tst-gettext6.c = -DOBJPFX=\"$(objpfx)\"
+tst-codeset-ENV = LOCPATH=$(common-objpfx)localedata
+tst-gettext3-ENV = LOCPATH=$(common-objpfx)localedata
+tst-gettext5-ENV = LOCPATH=$(common-objpfx)localedata
+
ifeq ($(have-thread-library),yes)
ifeq (yes,$(build-shared))
$(addprefix $(objpfx),$(multithread-test-srcs)): $(shared-thread-library)
diff --git a/intl/tst-codeset.sh b/intl/tst-codeset.sh
deleted file mode 100644
index 1584490..0000000
--- a/intl/tst-codeset.sh
+++ /dev/null
@@ -1,42 +0,0 @@
-#! /bin/sh
-# Test of bind_textdomain_codeset.
-# Copyright (C) 2001, 2002, 2005 Free Software Foundation, Inc.
-# This file is part of the GNU C Library.
-#
-
-# The GNU C Library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-
-# The GNU C Library 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
-# Lesser General Public License for more details.
-
-# You should have received a copy of the GNU Lesser General Public
-# License along with the GNU C Library; if not, see
-# <http://www.gnu.org/licenses/>.
-
-common_objpfx=$1
-objpfx=$2
-
-LC_ALL=C
-export LC_ALL
-
-# Generate the test data.
-msgfmt -o ${objpfx}codeset.mo.$$ tstcodeset.po || exit
-# Create the domain directories.
-mkdir -p ${objpfx}domaindir/de_DE/LC_MESSAGES
-# Populate them.
-mv -f ${objpfx}codeset.mo.$$ ${objpfx}domaindir/de_DE/LC_MESSAGES/codeset.mo
-
-GCONV_PATH=${common_objpfx}iconvdata
-export GCONV_PATH
-LOCPATH=${common_objpfx}localedata
-export LOCPATH
-
-${common_objpfx}elf/ld.so --library-path $common_objpfx \
-${objpfx}tst-codeset > ${objpfx}tst-codeset.out
-
-exit $?
diff --git a/intl/tst-gettext3.sh b/intl/tst-gettext3.sh
deleted file mode 100644
index 032379c..0000000
--- a/intl/tst-gettext3.sh
+++ /dev/null
@@ -1,43 +0,0 @@
-#! /bin/sh
-# Test that the gettext() results come out in the correct encoding for
-# locales that differ only in their encoding.
-# Copyright (C) 2001, 2002, 2005 Free Software Foundation, Inc.
-# This file is part of the GNU C Library.
-#
-
-# The GNU C Library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-
-# The GNU C Library 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
-# Lesser General Public License for more details.
-
-# You should have received a copy of the GNU Lesser General Public
-# License along with the GNU C Library; if not, see
-# <http://www.gnu.org/licenses/>.
-
-common_objpfx=$1
-objpfx=$2
-
-LC_ALL=C
-export LC_ALL
-
-# Generate the test data.
-msgfmt -o ${objpfx}codeset.mo.$$ tstcodeset.po || exit
-# Create the domain directories.
-mkdir -p ${objpfx}domaindir/de_DE/LC_MESSAGES
-# Populate them.
-mv -f ${objpfx}codeset.mo.$$ ${objpfx}domaindir/de_DE/LC_MESSAGES/codeset.mo
-
-GCONV_PATH=${common_objpfx}iconvdata
-export GCONV_PATH
-LOCPATH=${common_objpfx}localedata
-export LOCPATH
-
-${common_objpfx}elf/ld.so --library-path $common_objpfx \
-${objpfx}tst-gettext3 > ${objpfx}tst-gettext3.out
-
-exit $?
diff --git a/intl/tst-gettext5.sh b/intl/tst-gettext5.sh
deleted file mode 100755
index a563b43..0000000
--- a/intl/tst-gettext5.sh
+++ /dev/null
@@ -1,42 +0,0 @@
-#! /bin/sh
-# Test that gettext() in multithreaded applications works correctly if
-# different threads operate in different locales referring to the same
-# catalog file but with different encodings.
-# Copyright (C) 2001, 2002, 2005 Free Software Foundation, Inc.
-# This file is part of the GNU C Library.
-#
-
-# The GNU C Library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-
-# The GNU C Library 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
-# Lesser General Public License for more details.
-
-# You should have received a copy of the GNU Lesser General Public
-# License along with the GNU C Library; if not, see
-# <http://www.gnu.org/licenses/>.
-
-common_objpfx=$1
-run_program_prefix=$2
-objpfx=$3
-
-LC_ALL=C
-export LC_ALL
-
-# Create the domain directories.
-mkdir -p ${objpfx}domaindir/de_DE/LC_MESSAGES
-# Populate them.
-msgfmt -o ${objpfx}domaindir/de_DE/LC_MESSAGES/codeset.mo tstcodeset.po
-
-GCONV_PATH=${common_objpfx}iconvdata
-export GCONV_PATH
-LOCPATH=${common_objpfx}localedata
-export LOCPATH
-
-${run_program_prefix} ${objpfx}tst-gettext5 > ${objpfx}tst-gettext5.out
-
-exit $?
More information about the Libc-alpha
mailing list