From c9e127baf13a380081d96adcde60e252743543d1 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 25 Nov 2018 02:10:28 +0100 Subject: [PATCH] Fix some mingw test failures. * gettext-tools/tests/intl-1: Ignore different end-of-line convention in the output. * gettext-tools/tests/intl-2: Likewise. * gettext-tools/tests/intl-3: Likewise. * gettext-tools/tests/msgfmt-desktop-1: Likewise. * gettext-tools/tests/msgfmt-desktop-2: Likewise. * gettext-tools/tests/sentence-1: Likewise. * gettext-tools/tests/cldr-plurals-1: Likewise. * gettext-tools/tests/lang-c: On native Windows, ignore different end-of-line convention in the output. * gettext-tools/tests/lang-c++: Likewise. * gettext-tools/tests/msgfilter-8: On native Windows, use sh, not /bin/sh. --- gettext-tools/tests/cldr-plurals-1 | 12 ++++++++---- gettext-tools/tests/intl-1 | 6 ++++-- gettext-tools/tests/intl-2 | 12 ++++++++---- gettext-tools/tests/intl-3 | 24 ++++++++++++++++-------- gettext-tools/tests/lang-c | 16 ++++++++++++---- gettext-tools/tests/lang-c++ | 16 ++++++++++++---- gettext-tools/tests/msgfilter-8 | 5 ++++- gettext-tools/tests/msgfmt-desktop-1 | 3 ++- gettext-tools/tests/msgfmt-desktop-2 | 7 +++++-- gettext-tools/tests/sentence-1 | 3 ++- 10 files changed, 73 insertions(+), 31 deletions(-) diff --git a/gettext-tools/tests/cldr-plurals-1 b/gettext-tools/tests/cldr-plurals-1 index 18a8b61bb..3c6dad0df 100755 --- a/gettext-tools/tests/cldr-plurals-1 +++ b/gettext-tools/tests/cldr-plurals-1 @@ -15,9 +15,10 @@ cat > ar.ok <<\EOF nplurals=6; plural=(n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5); EOF -"$top_builddir/src/cldr-plurals" > ar.out <<\EOF +"$top_builddir/src/cldr-plurals" > ar.tmp <<\EOF zero: n = 0 @integer 0 @decimal 0.0, 0.00, 0.000, 0.0000; one: n = 1 @integer 1 @decimal 1.0, 1.00, 1.000, 1.0000; two: n = 2 @integer 2 @decimal 2.0, 2.00, 2.000, 2.0000; few: n % 100 = 3..10 @integer 3~10, 103~110, 1003, … @decimal 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 103.0, 1003.0, …; many: n % 100 = 11..99 @integer 11~26, 111, 1011, … @decimal 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 111.0, 1011.0, …; other: @integer 100~102, 200~202, 300~302, 400~402, 500~502, 600, 1000, 10000, 100000, 1000000, … @decimal 0.1~0.9, 1.1~1.7, 10.1, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, … EOF +LC_ALL=C tr -d '\r' < ar.tmp > ar.out || Exit 1 ${DIFF} ar.ok ar.out || Exit 1 @@ -25,9 +26,10 @@ cat > ru.ok <<\EOF nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : 2); EOF -"$top_builddir/src/cldr-plurals" > ru.out <<\EOF +"$top_builddir/src/cldr-plurals" > ru.tmp <<\EOF one: v = 0 and i % 10 = 1 and i % 100 != 11 @integer 1, 21, 31, 41, 51, 61, 71, 81, 101, 1001, …; few: v = 0 and i % 10 = 2..4 and i % 100 != 12..14 @integer 2~4, 22~24, 32~34, 42~44, 52~54, 62, 102, 1002, …; many: v = 0 and i % 10 = 0 or v = 0 and i % 10 = 5..9 or v = 0 and i % 100 = 11..14 @integer 0, 5~19, 100, 1000, 10000, 100000, 1000000, …; other: @decimal 0.0~1.5, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, … EOF +LC_ALL=C tr -d '\r' < ru.tmp > ru.out || Exit 1 ${DIFF} ru.ok ru.out || Exit 1 @@ -44,16 +46,18 @@ cat > foo.in <<\EOF EOF -"$top_builddir/src/cldr-plurals" foo foo.in > foo.out +"$top_builddir/src/cldr-plurals" foo foo.in > foo.tmp cat > foo.ok <<\EOF nplurals=2; plural=(n != 1); EOF +LC_ALL=C tr -d '\r' < foo.tmp > foo.out || Exit 1 ${DIFF} foo.ok foo.out || Exit 1 -"$top_builddir/src/cldr-plurals" -c foo foo.in > foo.cldr.out +"$top_builddir/src/cldr-plurals" -c foo foo.in > foo.cldr.tmp cat > foo.cldr.ok <<\EOF one: i = 1 and v = 0 @integer 1; other: @integer 0, 2~16, 100, 1000, 10000, 100000, 1000000, … @decimal 0.0~1.5, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, … EOF +LC_ALL=C tr -d '\r' < foo.cldr.tmp > foo.cldr.out || Exit 1 ${DIFF} foo.cldr.ok foo.cldr.out || Exit 1 Exit 0 diff --git a/gettext-tools/tests/intl-1 b/gettext-tools/tests/intl-1 index 76fb75e0e..cf0f8df80 100755 --- a/gettext-tools/tests/intl-1 +++ b/gettext-tools/tests/intl-1 @@ -19,12 +19,14 @@ EOF : ${LOCALE_FR_UTF8=fr_FR.UTF-8} if test $LOCALE_FR != none; then prepare_locale_ in-1/fr in-1/$LOCALE_FR - ../intl-1-prg in-1 $LOCALE_FR > in-1.out || Exit 1 + ../intl-1-prg in-1 $LOCALE_FR > in-1.tmp || Exit 1 + LC_ALL=C tr -d '\r' < in-1.tmp > in-1.out || Exit 1 ${DIFF} in-1.ok in-1.out || Exit 1 fi if test $LOCALE_FR_UTF8 != none; then prepare_locale_ in-1/fr in-1/$LOCALE_FR_UTF8 - ../intl-1-prg in-1 $LOCALE_FR_UTF8 > in-1.out || Exit 1 + ../intl-1-prg in-1 $LOCALE_FR_UTF8 > in-1.tmp || Exit 1 + LC_ALL=C tr -d '\r' < in-1.tmp > in-1.out || Exit 1 ${DIFF} in-1.ok in-1.out || Exit 1 fi if test $LOCALE_FR = none && test $LOCALE_FR_UTF8 = none; then diff --git a/gettext-tools/tests/intl-2 b/gettext-tools/tests/intl-2 index a061d57ab..a2a2d8dbd 100755 --- a/gettext-tools/tests/intl-2 +++ b/gettext-tools/tests/intl-2 @@ -30,17 +30,21 @@ EOF if test $LOCALE_FR != none; then prepare_locale_ in-2-1/fr in-2-1/$LOCALE_FR prepare_locale_ in-2-2/fr in-2-2/$LOCALE_FR - ../intl-1-prg in-2-1 $LOCALE_FR > in-2.out || Exit 1 + ../intl-1-prg in-2-1 $LOCALE_FR > in-2.tmp || Exit 1 + LC_ALL=C tr -d '\r' < in-2.tmp > in-2.out || Exit 1 ${DIFF} in-2-1.ok in-2.out || Exit 1 - ../intl-1-prg in-2-2 $LOCALE_FR > in-2.out || Exit 1 + ../intl-1-prg in-2-2 $LOCALE_FR > in-2.tmp || Exit 1 + LC_ALL=C tr -d '\r' < in-2.tmp > in-2.out || Exit 1 ${DIFF} in-2-1.ok in-2.out || Exit 1 fi if test $LOCALE_FR_UTF8 != none; then prepare_locale_ in-2-1/fr in-2-1/$LOCALE_FR_UTF8 prepare_locale_ in-2-2/fr in-2-2/$LOCALE_FR_UTF8 - ../intl-1-prg in-2-1 $LOCALE_FR_UTF8 > in-2.out || Exit 1 + ../intl-1-prg in-2-1 $LOCALE_FR_UTF8 > in-2.tmp || Exit 1 + LC_ALL=C tr -d '\r' < in-2.tmp > in-2.out || Exit 1 ${DIFF} in-2-2.ok in-2.out || Exit 1 - ../intl-1-prg in-2-2 $LOCALE_FR_UTF8 > in-2.out || Exit 1 + ../intl-1-prg in-2-2 $LOCALE_FR_UTF8 > in-2.tmp || Exit 1 + LC_ALL=C tr -d '\r' < in-2.tmp > in-2.out || Exit 1 ${DIFF} in-2-2.ok in-2.out || Exit 1 fi if test $LOCALE_FR = none && test $LOCALE_FR_UTF8 = none; then diff --git a/gettext-tools/tests/intl-3 b/gettext-tools/tests/intl-3 index 4879e24ed..8c12083ae 100755 --- a/gettext-tools/tests/intl-3 +++ b/gettext-tools/tests/intl-3 @@ -30,25 +30,33 @@ EOF if test $LOCALE_FR != none; then prepare_locale_ in-3-1/fr in-3-1/$LOCALE_FR prepare_locale_ in-3-2/fr in-3-2/$LOCALE_FR - ../intl-3-prg in-3-1 $LOCALE_FR ISO-8859-1 > in-3.out || Exit 1 + ../intl-3-prg in-3-1 $LOCALE_FR ISO-8859-1 > in-3.tmp || Exit 1 + LC_ALL=C tr -d '\r' < in-3.tmp > in-3.out || Exit 1 ${DIFF} in-3-1.ok in-3.out || Exit 1 - ../intl-3-prg in-3-2 $LOCALE_FR ISO-8859-1 > in-3.out || Exit 1 + ../intl-3-prg in-3-2 $LOCALE_FR ISO-8859-1 > in-3.tmp || Exit 1 + LC_ALL=C tr -d '\r' < in-3.tmp > in-3.out || Exit 1 ${DIFF} in-3-1.ok in-3.out || Exit 1 - ../intl-3-prg in-3-1 $LOCALE_FR UTF-8 > in-3.out || Exit 1 + ../intl-3-prg in-3-1 $LOCALE_FR UTF-8 > in-3.tmp || Exit 1 + LC_ALL=C tr -d '\r' < in-3.tmp > in-3.out || Exit 1 ${DIFF} in-3-2.ok in-3.out || Exit 1 - ../intl-3-prg in-3-2 $LOCALE_FR UTF-8 > in-3.out || Exit 1 + ../intl-3-prg in-3-2 $LOCALE_FR UTF-8 > in-3.tmp || Exit 1 + LC_ALL=C tr -d '\r' < in-3.tmp > in-3.out || Exit 1 ${DIFF} in-3-2.ok in-3.out || Exit 1 fi if test $LOCALE_FR_UTF8 != none; then prepare_locale_ in-3-1/fr in-3-1/$LOCALE_FR_UTF8 prepare_locale_ in-3-2/fr in-3-2/$LOCALE_FR_UTF8 - ../intl-3-prg in-3-1 $LOCALE_FR_UTF8 ISO-8859-1 > in-3.out || Exit 1 + ../intl-3-prg in-3-1 $LOCALE_FR_UTF8 ISO-8859-1 > in-3.tmp || Exit 1 + LC_ALL=C tr -d '\r' < in-3.tmp > in-3.out || Exit 1 ${DIFF} in-3-1.ok in-3.out || Exit 1 - ../intl-3-prg in-3-2 $LOCALE_FR_UTF8 ISO-8859-1 > in-3.out || Exit 1 + ../intl-3-prg in-3-2 $LOCALE_FR_UTF8 ISO-8859-1 > in-3.tmp || Exit 1 + LC_ALL=C tr -d '\r' < in-3.tmp > in-3.out || Exit 1 ${DIFF} in-3-1.ok in-3.out || Exit 1 - ../intl-3-prg in-3-1 $LOCALE_FR_UTF8 UTF-8 > in-3.out || Exit 1 + ../intl-3-prg in-3-1 $LOCALE_FR_UTF8 UTF-8 > in-3.tmp || Exit 1 + LC_ALL=C tr -d '\r' < in-3.tmp > in-3.out || Exit 1 ${DIFF} in-3-2.ok in-3.out || Exit 1 - ../intl-3-prg in-3-2 $LOCALE_FR_UTF8 UTF-8 > in-3.out || Exit 1 + ../intl-3-prg in-3-2 $LOCALE_FR_UTF8 UTF-8 > in-3.tmp || Exit 1 + LC_ALL=C tr -d '\r' < in-3.tmp > in-3.out || Exit 1 ${DIFF} in-3-2.ok in-3.out || Exit 1 fi if test $LOCALE_FR = none && test $LOCALE_FR_UTF8 = none; then diff --git a/gettext-tools/tests/lang-c b/gettext-tools/tests/lang-c index ad6be73f7..b350899a6 100755 --- a/gettext-tools/tests/lang-c +++ b/gettext-tools/tests/lang-c @@ -130,18 +130,26 @@ EOF : ${LOCALE_FR_UTF8=fr_FR.UTF-8} if test $LOCALE_FR != none; then prepare_locale_ fr $LOCALE_FR - LANGUAGE= ./prog $LOCALE_FR 2 > prog.out + LANGUAGE= ./prog $LOCALE_FR 2 > prog.tmp case $? in - 0) ${DIFF} prog.ok prog.out || Exit 1;; + 0) case "$host_os" in + mingw*) LC_ALL=C tr -d '\r' < prog.tmp > prog.out || Exit 1 ;; + *) cp prog.tmp prog.out || Exit 1 ;; + esac + ${DIFF} prog.ok prog.out || Exit 1;; 77) LOCALE_FR=none;; *) Exit 1;; esac fi if test $LOCALE_FR_UTF8 != none; then prepare_locale_ fr $LOCALE_FR_UTF8 - LANGUAGE= ./prog $LOCALE_FR_UTF8 2 > prog.out + LANGUAGE= ./prog $LOCALE_FR_UTF8 2 > prog.tmp case $? in - 0) ${DIFF} prog.oku prog.out || Exit 1;; + 0) case "$host_os" in + mingw*) LC_ALL=C tr -d '\r' < prog.tmp > prog.out || Exit 1 ;; + *) cp prog.tmp prog.out || Exit 1 ;; + esac + ${DIFF} prog.oku prog.out || Exit 1;; 77) LOCALE_FR_UTF8=none;; *) Exit 1;; esac diff --git a/gettext-tools/tests/lang-c++ b/gettext-tools/tests/lang-c++ index cad6af8bb..f2b72ac19 100755 --- a/gettext-tools/tests/lang-c++ +++ b/gettext-tools/tests/lang-c++ @@ -150,18 +150,26 @@ EOF : ${LOCALE_FR_UTF8=fr_FR.UTF-8} if test $LOCALE_FR != none; then prepare_locale_ fr $LOCALE_FR - LANGUAGE= ./prog $LOCALE_FR 2 > prog.out + LANGUAGE= ./prog $LOCALE_FR 2 > prog.tmp case $? in - 0) ${DIFF} prog.ok prog.out || Exit 1;; + 0) case "$host_os" in + mingw*) LC_ALL=C tr -d '\r' < prog.tmp > prog.out || Exit 1 ;; + *) cp prog.tmp prog.out || Exit 1 ;; + esac + ${DIFF} prog.ok prog.out || Exit 1;; 77) LOCALE_FR=none;; *) Exit 1;; esac fi if test $LOCALE_FR_UTF8 != none; then prepare_locale_ fr $LOCALE_FR_UTF8 - LANGUAGE= ./prog $LOCALE_FR_UTF8 2 > prog.out + LANGUAGE= ./prog $LOCALE_FR_UTF8 2 > prog.tmp case $? in - 0) ${DIFF} prog.oku prog.out || Exit 1;; + 0) case "$host_os" in + mingw*) LC_ALL=C tr -d '\r' < prog.tmp > prog.out || Exit 1 ;; + *) cp prog.tmp prog.out || Exit 1 ;; + esac + ${DIFF} prog.oku prog.out || Exit 1;; 77) LOCALE_FR_UTF8=none;; *) Exit 1;; esac diff --git a/gettext-tools/tests/msgfilter-8 b/gettext-tools/tests/msgfilter-8 index f7b7b27c5..9b665eb31 100755 --- a/gettext-tools/tests/msgfilter-8 +++ b/gettext-tools/tests/msgfilter-8 @@ -76,7 +76,10 @@ fi EOF : ${MSGFILTER=msgfilter} -: ${CONFIG_SHELL=${SHELL-/bin/sh}} +case "$host_os" in + mingw*) CONFIG_SHELL='sh' ;; + *) : ${CONFIG_SHELL=${SHELL-/bin/sh}} ;; +esac LC_ALL=C ${MSGFILTER} --newline -i mfi-test8.po -o mfi-test8.out \ ${CONFIG_SHELL} filter.sh >mfi-test8.err 2>&1 result=$? diff --git a/gettext-tools/tests/msgfmt-desktop-1 b/gettext-tools/tests/msgfmt-desktop-1 index 24b748458..d410c0101 100755 --- a/gettext-tools/tests/msgfmt-desktop-1 +++ b/gettext-tools/tests/msgfmt-desktop-1 @@ -75,8 +75,9 @@ ${MSGFMT} --desktop --template=mf.desktop fr.po -o mf.desktop.out \ # Proceed to the .desktop file generation. -${MSGFMT} --desktop --template=mf.desktop -l fr fr.po -o mf.desktop.out \ +${MSGFMT} --desktop --template=mf.desktop -l fr fr.po -o mf.desktop.tmp \ || Exit 1 +LC_ALL=C tr -d '\r' < mf.desktop.tmp > mf.desktop.out || Exit 1 : ${DIFF=diff} ${DIFF} mf.desktop.ok mf.desktop.out diff --git a/gettext-tools/tests/msgfmt-desktop-2 b/gettext-tools/tests/msgfmt-desktop-2 index 19391cab0..d131980d8 100755 --- a/gettext-tools/tests/msgfmt-desktop-2 +++ b/gettext-tools/tests/msgfmt-desktop-2 @@ -160,7 +160,8 @@ ${MSGFMT} --desktop --template=mf.desktop -d po -o mf.desktop.out po/fr.po \ # Proceed to the .desktop file generation. -${MSGFMT} --desktop --template=mf.desktop -d po -o mf.desktop.out || Exit 1 +${MSGFMT} --desktop --template=mf.desktop -d po -o mf.desktop.tmp || Exit 1 +LC_ALL=C tr -d '\r' < mf.desktop.tmp > mf.desktop.out || Exit 1 : ${DIFF=diff} ${DIFF} mf.desktop.ok mf.desktop.out @@ -168,7 +169,9 @@ test $? = 0 || Exit 1 # Restrict the desired languages with the LINGUAS envvar. -LINGUAS="fr ja" ${MSGFMT} --desktop --template=mf.desktop -d po -o mf.desktop.desired.out || Exit 1 +LINGUAS="fr ja" \ +${MSGFMT} --desktop --template=mf.desktop -d po -o mf.desktop.desired.tmp || Exit 1 +LC_ALL=C tr -d '\r' < mf.desktop.desired.tmp > mf.desktop.desired.out || Exit 1 : ${DIFF=diff} ${DIFF} mf.desktop.desired.ok mf.desktop.desired.out diff --git a/gettext-tools/tests/sentence-1 b/gettext-tools/tests/sentence-1 index 62b5a04be..7df9e2cd8 100755 --- a/gettext-tools/tests/sentence-1 +++ b/gettext-tools/tests/sentence-1 @@ -113,7 +113,8 @@ This is a secondary sentence EOF -../sentence-1-prg < s1.in > s1.out || Exit 1 +../sentence-1-prg < s1.in > s1.tmp || Exit 1 +LC_ALL=C tr -d '\r' < s1.tmp > s1.out || Exit 1 : ${DIFF=diff} ${DIFF} s1.ok s1.out || Exit 1 -- 2.47.2