[commit: nofib] wip/boot-compress2: Compare output of compress2 by hashing (2c6e793)
git at git.haskell.org
git at git.haskell.org
Mon Dec 31 10:02:01 UTC 2018
Repository : ssh://git@git.haskell.org/nofib
On branch : wip/boot-compress2
Link : http://ghc.haskell.org/trac/ghc/changeset/2c6e793c4dbe321e64a57870ca7014a174f86c36/nofib
>---------------------------------------------------------------
commit 2c6e793c4dbe321e64a57870ca7014a174f86c36
Author: Sebastian Graf <sgraf1337 at gmail.com>
Date: Mon Dec 31 11:00:41 2018 +0100
Compare output of compress2 by hashing
This should fix the build in the same way as D5469.
>---------------------------------------------------------------
2c6e793c4dbe321e64a57870ca7014a174f86c36
.gitignore | 1 -
real/compress2/Main.hs | 7 ++++++-
real/compress2/Makefile | 10 +++-------
real/compress2/compress2.faststdout | Bin 44152 -> 20 bytes
real/compress2/compress2.stdout | 1 +
5 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/.gitignore b/.gitignore
index f1fae44..6730d53 100644
--- a/.gitignore
+++ b/.gitignore
@@ -36,7 +36,6 @@ real/compress/compress
real/compress/compress.stdin
real/compress2/compress2
real/compress2/compress2.stdin
-real/compress2/compress2.stdout
real/eff/CS/CS
real/eff/CSD/CSD
real/eff/FS/FS
diff --git a/real/compress2/Main.hs b/real/compress2/Main.hs
index 3562644..71fe22b 100644
--- a/real/compress2/Main.hs
+++ b/real/compress2/Main.hs
@@ -8,12 +8,17 @@ where
import Encode
import WriteRoutines
import System.IO
+import Data.Char
+import Data.List (foldl')
+
+hash :: String -> Int
+hash = foldl' (\acc c -> ord c + acc*31) 0
main = do
hSetBinaryMode stdin True
hSetBinaryMode stdout True
i <- getContents
- putStr (compress i)
+ print (hash (compress i))
-- The output is given by a magic header consisting of two fixed numbers,
-- and a third representing the maximum number of bits used per code and
diff --git a/real/compress2/Makefile b/real/compress2/Makefile
index 7a605f6..b969707 100644
--- a/real/compress2/Makefile
+++ b/real/compress2/Makefile
@@ -7,17 +7,13 @@ SRC_HC_OPTS += -fglasgow-exts
SRC_RUNTEST_OPTS += +RTS -H100m -RTS
+CLEAN_FILES += compress2.stdin
+
include $(TOP)/mk/target.mk
-boot :: compress2.stdin compress2.faststdin compress2.stdout
+boot :: compress2.stdin
CAT_FILES = compress2.faststdin *.hs compress2.faststdin *.hs
compress2.stdin : compress2.faststdin
cat $(CAT_FILES) $(CAT_FILES) $(CAT_FILES) $(CAT_FILES) $(CAT_FILES) > compress2.stdin
-
-compress2.stdout : compress2.stdin compress2
- ./compress2 < compress2.stdin > compress2.stdout
-
-clean ::
- rm -f compress2.stdin compress2.stdout
diff --git a/real/compress2/compress2.faststdout b/real/compress2/compress2.faststdout
index d5c2f00..1d09915 100644
Binary files a/real/compress2/compress2.faststdout and b/real/compress2/compress2.faststdout differ
diff --git a/real/compress2/compress2.stdout b/real/compress2/compress2.stdout
new file mode 100644
index 0000000..81bb35c
--- /dev/null
+++ b/real/compress2/compress2.stdout
@@ -0,0 +1 @@
+-6634557641809225147
More information about the ghc-commits
mailing list