Commit 63ce82ac authored by Ben Gamari's avatar Ben Gamari 🐢

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
parent 7debffc1
# Generated file patterns # Generated file patterns
*.exe
*.o *.o
*.hi *.hi
.depend .depend
......
...@@ -55,11 +55,9 @@ if ( $ENV{'TMPDIR'} ) { # where to make tmp file names ...@@ -55,11 +55,9 @@ if ( $ENV{'TMPDIR'} ) { # where to make tmp file names
$TmpPrefix = '/tmp'; $TmpPrefix = '/tmp';
$ENV{'TMPDIR'} = '/tmp'; # set the env var as well $ENV{'TMPDIR'} = '/tmp'; # set the env var as well
} }
$cmp = "cmp -s";
# If this is Msys, ignore eol and CR characters. # If this is Msys, ignore eol and CR characters.
if ( `uname -s | grep MSYS` ) { if ( `uname -s | grep MSYS` ) {
$CONTEXT_DIFF=$CONTEXT_DIFF . " --strip-trailing-cr" ; $CONTEXT_DIFF=$CONTEXT_DIFF . " --strip-trailing-cr" ;
$cmp = $CONTEXT_DIFF . " -q";
} }
$ScriptFile = "$TmpPrefix/run_me$$"; $ScriptFile = "$TmpPrefix/run_me$$";
$DefaultStdoutFile = "$TmpPrefix/no_stdout$$"; # can't use /dev/null (e.g. Alphas) $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 ...@@ -235,17 +233,17 @@ $TimeCmd /bin/sh -c \'$CachegrindPrefix $ToRun $TimingMagic @PgmArgs < $PgmStdin
progexit=\$? progexit=\$?
if [ "$StdoutBinary" = "0" ]; then if [ "$StdoutBinary" = "0" ]; then
# remove Windows \r carraige-returns # 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 else
cp $TmpPrefix/runtest$$.1.raw $TmpPrefix/runtest$$.1 cp $TmpPrefix/runtest$$.1.raw $TmpPrefix/runtest$$.1
fi fi
if [ "$StderrBinary" = "0" ]; then if [ "$StderrBinary" = "0" ]; then
# remove Windows \r carraige-returns # 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 else
cp $TmpPrefix/runtest$$.2.raw $TmpPrefix/runtest$$.2 cp $TmpPrefix/runtest$$.2.raw $TmpPrefix/runtest$$.2
fi 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 if [ \$progexit -eq 0 ] && [ $PgmFail -ne 0 ]; then
echo $ToRun @PgmArgs \\< $PgmStdinFile echo $ToRun @PgmArgs \\< $PgmStdinFile
echo "****" expected a failure, but was successful echo "****" expected a failure, but was successful
...@@ -259,7 +257,7 @@ else ...@@ -259,7 +257,7 @@ else
$PostScriptLines $PostScriptLines
hit='NO' hit='NO'
for out_file in @PgmStdoutFile ; do 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' hit='YES'
fi fi
done done
...@@ -285,7 +283,7 @@ fi ...@@ -285,7 +283,7 @@ fi
hit='NO' hit='NO'
for out_file in @PgmStderrFile ; do 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' hit='YES'
fi fi
done done
......
...@@ -20,13 +20,13 @@ fasta-c : fasta-c.c ...@@ -20,13 +20,13 @@ fasta-c : fasta-c.c
$(CC) -std=gnu99 -O3 -fomit-frame-pointer $< -o $@ $(CC) -std=gnu99 -O3 -fomit-frame-pointer $< -o $@
fasta.faststdout : fasta-c fasta.faststdout : fasta-c
./fasta-c $(FAST_OPTS) > $@ ./fasta-c $(FAST_OPTS) | tr -d '\r' > $@
fasta.stdout : fasta-c fasta.stdout : fasta-c
./fasta-c $(NORM_OPTS) > $@ ./fasta-c $(NORM_OPTS) | tr -d '\r' > $@
fasta.slowstdout : fasta-c 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 # 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 # `make boot` and only than `make` (otherwise `make` doesn't "see" the file and
......
...@@ -51,13 +51,13 @@ revcomp-c : revcomp-c.o ...@@ -51,13 +51,13 @@ revcomp-c : revcomp-c.o
gcc $< -o $@ -pthread gcc $< -o $@ -pthread
reverse-complement.faststdout : revcomp-c $(INPUT_FILE) 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) 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) 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 # 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 # `make boot` and only than `make` (otherwise `make` doesn't "see" the file and
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment