[commit: nofib] master: Fix CRLF handling in NoFib (63ce82a)

git at git.haskell.org git at git.haskell.org
Tue Aug 15 01:35:17 UTC 2017


Repository : ssh://git@git.haskell.org/nofib

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/63ce82acf38ef20d20fde6e80c5075c14fe8246c/nofib

>---------------------------------------------------------------

commit 63ce82acf38ef20d20fde6e80c5075c14fe8246c
Author: Ben Gamari <ben at smart-cactus.org>
Date:   Mon Aug 14 20:48:53 2017 -0400

    Fix CRLF handling in NoFib
    
    See https://phabricator.haskell.org/D3030#98590.
    
    The current master uses the diff alias for comparison, which pollutes
    stdout. I fixed the tr -d '\r' calls that previously were in place, but
    broken due to escaping. I also did the same for golden master generation
    in shootout Makefiles.
    
    Test Plan:
    
    ```
    make clean && \
    make NoFibRuns=1 2>&1 > nofib.log && \
    nofib-analyse/nofib-analyse nofib.log
    ```
    
    Differential Revision: https://phabricator.haskell.org/D3450


>---------------------------------------------------------------

63ce82acf38ef20d20fde6e80c5075c14fe8246c
 .gitignore                           |  1 +
 runstdtest/runstdtest.prl            | 12 +++++-------
 shootout/fasta/Makefile              |  6 +++---
 shootout/reverse-complement/Makefile |  6 +++---
 4 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/.gitignore b/.gitignore
index c5604e8..baaa6e3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
 # Generated file patterns
+*.exe
 *.o
 *.hi
 .depend
diff --git a/runstdtest/runstdtest.prl b/runstdtest/runstdtest.prl
index f1ebbd8..648f381 100644
--- a/runstdtest/runstdtest.prl
+++ b/runstdtest/runstdtest.prl
@@ -55,11 +55,9 @@ if ( $ENV{'TMPDIR'} ) { # where to make tmp file names
     $TmpPrefix = '/tmp';
     $ENV{'TMPDIR'} = '/tmp'; # set the env var as well
 }
-$cmp = "cmp -s";
 # If this is Msys, ignore eol and CR characters.
 if ( `uname -s | grep MSYS` ) {
     $CONTEXT_DIFF=$CONTEXT_DIFF . " --strip-trailing-cr" ;
-    $cmp = $CONTEXT_DIFF . " -q";
 }
 $ScriptFile = "$TmpPrefix/run_me$$";
 $DefaultStdoutFile = "$TmpPrefix/no_stdout$$"; # can't use /dev/null (e.g. Alphas)
@@ -235,17 +233,17 @@ $TimeCmd /bin/sh -c \'$CachegrindPrefix $ToRun $TimingMagic @PgmArgs < $PgmStdin
 progexit=\$?
 if [ "$StdoutBinary" = "0" ]; then
     # remove Windows \r carraige-returns
-    LC_CTYPE=C tr -d '\r' < $TmpPrefix/runtest$$.1.raw > $TmpPrefix/runtest$$.1
+    LC_CTYPE=C tr -d '\\r' < $TmpPrefix/runtest$$.1.raw > $TmpPrefix/runtest$$.1
 else
     cp $TmpPrefix/runtest$$.1.raw $TmpPrefix/runtest$$.1
 fi
 if [ "$StderrBinary" = "0" ]; then
     # remove Windows \r carraige-returns
-    LC_CTYPE=C tr -d '\r' < $TmpPrefix/runtest$$.2.raw > $TmpPrefix/runtest$$.2
+    LC_CTYPE=C tr -d '\\r' < $TmpPrefix/runtest$$.2.raw > $TmpPrefix/runtest$$.2
 else
     cp $TmpPrefix/runtest$$.2.raw $TmpPrefix/runtest$$.2
 fi
-LC_CTYPE=C tr -d '\r' < $TmpPrefix/runtest$$.3.raw > $TmpPrefix/runtest$$.3
+LC_CTYPE=C tr -d '\\r' < $TmpPrefix/runtest$$.3.raw > $TmpPrefix/runtest$$.3
 if [ \$progexit -eq 0 ] && [ $PgmFail -ne 0 ]; then
     echo $ToRun @PgmArgs \\< $PgmStdinFile
     echo "****" expected a failure, but was successful
@@ -259,7 +257,7 @@ else
     $PostScriptLines
     hit='NO'
     for out_file in @PgmStdoutFile ; do
-	if $cmp \$out_file $TmpPrefix/runtest$$.1 ; then
+	if cmp -s \$out_file $TmpPrefix/runtest$$.1 ; then
 	    hit='YES'
 	fi
     done
@@ -285,7 +283,7 @@ fi
 
 hit='NO'
 for out_file in @PgmStderrFile ; do
-    if $cmp \$out_file $TmpPrefix/runtest$$.2 ; then
+    if cmp -s \$out_file $TmpPrefix/runtest$$.2 ; then
 	hit='YES'
     fi
 done
diff --git a/shootout/fasta/Makefile b/shootout/fasta/Makefile
index 68e6279..f6beb8e 100644
--- a/shootout/fasta/Makefile
+++ b/shootout/fasta/Makefile
@@ -20,13 +20,13 @@ fasta-c : fasta-c.c
 	$(CC) -std=gnu99 -O3 -fomit-frame-pointer $< -o $@
 
 fasta.faststdout : fasta-c
-	./fasta-c $(FAST_OPTS) > $@
+	./fasta-c $(FAST_OPTS) | tr -d '\r' > $@
 
 fasta.stdout : fasta-c
-	./fasta-c $(NORM_OPTS) > $@
+	./fasta-c $(NORM_OPTS) | tr -d '\r' > $@
 
 fasta.slowstdout : fasta-c
-	./fasta-c $(SLOW_OPTS) > $@
+	./fasta-c $(SLOW_OPTS) | tr -d '\r' > $@
 
 # Since we only decide here what the INPUT_FILE is, it's required to first run
 # `make boot` and only than `make` (otherwise `make` doesn't "see" the file and
diff --git a/shootout/reverse-complement/Makefile b/shootout/reverse-complement/Makefile
index 8fd7a9d..c165f2f 100644
--- a/shootout/reverse-complement/Makefile
+++ b/shootout/reverse-complement/Makefile
@@ -51,13 +51,13 @@ revcomp-c : revcomp-c.o
 	gcc $< -o $@ -pthread
 
 reverse-complement.faststdout : revcomp-c $(INPUT_FILE)
-	./revcomp-c < $(INPUT_FILE) > $@
+	./revcomp-c < $(INPUT_FILE) | tr -d '\r' > $@
 
 reverse-complement.stdout : revcomp-c $(INPUT_FILE)
-	./revcomp-c < $(INPUT_FILE) > $@
+	./revcomp-c < $(INPUT_FILE) | tr -d '\r' > $@
 
 reverse-complement.slowstdout : revcomp-c $(INPUT_FILE)
-	./revcomp-c < $(INPUT_FILE) > $@
+	./revcomp-c < $(INPUT_FILE) | tr -d '\r' > $@
 
 # Since we only decide here what the OUTPUT_FILE is, it's required to first run
 # `make boot` and only than `make` (otherwise `make` doesn't "see" the file and



More information about the ghc-commits mailing list