libtool-patches
[Top][All Lists]
Advanced

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

Re: Unify line endings in localization test


From: Peter Rosin
Subject: Re: Unify line endings in localization test
Date: Thu, 22 Jan 2009 10:57:20 +0100
User-agent: Thunderbird 2.0.0.19 (Windows/20081209)

Den 2009-01-21 23:09, skrev Ralf Wildenhues:
* Peter Rosin wrote on Tue, Jan 20, 2009 at 12:34:57AM CET:
Den 2009-01-19 21:35 skrev Ralf Wildenhues:
This looks a bit hackish.  We already have a handful of places which we
fixed up in order to avoid line ending issues.  This one looks hackish
enough to deserve being wrapped in a macro (in testsuite.at, below
LT_AT_HOST_DATA?), so that future instances of this issue can easily be
handled likewise.
Something like the attached?

Yes, with nits below addressed.

--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -204,6 +204,19 @@ case $host_os in mingw*)
 esac])
+# LT_AT_UNIFY_NL(FILE, [RESULT-FILE])
+# --------------------

Let's underline the whole text.  :-)

+# Ensure (text) file has predicable line endings.

FILE.  Please describe RESULT-FILE.  Typo "predictable".

+m4_define([LT_AT_UNIFY_NL],
+[case $host_os in
+ mingw*)
+  tr -d '\015' < $1 > m4_ifval([$2], [$2], [$1.t
+  mv -f $1.t $1]) ;; m4_ifval([$2], [
+ *)
+  mv -f $1 $2 ;;])
+esac])

1 or 2 characters of indentation?  ;-)

An even easier-to-use interface would be an LT_AT_CHECK_FF or so,
which would check after converting to a standard file format.
But the above is good enough, and easy enough to use, and the
full solution would require us to hack up more, with LT_AT_EXEC_CHECK
and all.  So let's use this.

Hi Ralf,

Thanks for the review!

Ok, so push to master or pr-msvc-support? And one more thing I just
realized, on MinGW the two-arg version leaves FILE intact which does
not happen for other hosts. Should that be fixed? With an rm for MinGW
or with cp instead of the mv for others?

Cheers,
Peter

2009-01-22  Peter Rosin  <address@hidden>

        Unify line endings in localization test.
        * tests/testsuite.at: Update copyright year.
        (LT_AT_UNIFY_NL): Add macro that unifies line endings on
        platforms that suffer from such confusion.
        * tests/localization.at: Use it. Update copyright year. Fixes
        the test on MSYS/MSVC.
diff --git a/tests/localization.at b/tests/localization.at
index d489fef..92b19ac 100644
--- a/tests/localization.at
+++ b/tests/localization.at
@@ -1,6 +1,6 @@
 # localization.at -- libtool and locales                -*- Autotest -*-
 #
-#   Copyright (C) 2008 Free Software Foundation, Inc.
+#   Copyright (C) 2008, 2009 Free Software Foundation, Inc.
 #   Written by Ralf Wildenhues, 2008
 #
 #   This file is part of GNU Libtool.
@@ -43,13 +43,16 @@ AT_CHECK([$CC $CPPFLAGS $CFLAGS -c b.c || exit 77], [], 
[stdout], [stderr])
 
 # Find out about expected output.
 AT_CHECK([$CC $CPPFLAGS $CFLAGS -c a.c || exit 1], [1], [stdout], [stderr])
-mv -f stdout expected-stdout
-mv -f stderr expected-stderr
+LT_AT_UNIFY_NL([stdout], [expected-stdout])
+LT_AT_UNIFY_NL([stderr], [expected-stderr])
 AT_CHECK([$LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c a.c || 
exit 1],
         [1], [stdout], [stderr])
+LT_AT_UNIFY_NL([stderr])
 AT_CHECK([diff expected-stderr stderr])
 LTBASE=`$ECHO "$LIBTOOL" | sed 's,^.*/,,'`
-AT_CHECK([grep -v "^$LTBASE: compile" stdout | diff expected-stdout -])
+grep -v "^$LTBASE: compile" stdout > libtool-stdout
+LT_AT_UNIFY_NL([libtool-stdout])
+AT_CHECK([diff expected-stdout libtool-stdout])
 
 # check that we get our quoting right.
 LANGUAGE='a; nosuchprogram " '\''  & $x /#+*(){}|,:`\ !%'
diff --git a/tests/testsuite.at b/tests/testsuite.at
index f116a1f..7c3ee73 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -1,6 +1,6 @@
 # Process with autom4te to create an -*- Autotest -*- test suite.
 #
-#   Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software
+#   Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Free Software
 #   Foundation, Inc.
 #   Written by Gary V. Vaughan, 2004
 #
@@ -204,6 +204,20 @@ case $host_os in mingw*)
 esac])
 
 
+# LT_AT_UNIFY_NL(FILE, [RESULT-FILE])
+# -----------------------------------
+# Ensure (text) FILE has predictable line endings.
+# If RESULT-FILE is not given, convert in-place.
+m4_define([LT_AT_UNIFY_NL],
+[case $host_os in
+  mingw*)
+    tr -d '\015' < $1 > m4_ifval([$2], [$2], [$1.t
+    mv -f $1.t $1]) ;; m4_ifval([$2], [
+  *)
+    mv -f $1 $2 ;;])
+esac])
+
+
 # LT_AT_EXEC_CHECK(EXECUTABLE, [STATUS = 0], [STDOUT], [STDERR],
 #                 [ARGS-OR-STATUS-ADJUST])
 # --------------------------------------------------------------

reply via email to

[Prev in Thread] Current Thread [Next in Thread]