[commit: nofib] master: Compare output of compress2 by hashing (c3acdcc)

git at git.haskell.org git at git.haskell.org
Tue Jan 1 17:27:23 UTC 2019


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

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

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

commit c3acdcc648b5041c2d2d7de232680ddc9af0b20d
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 !2.


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

c3acdcc648b5041c2d2d7de232680ddc9af0b20d
 .gitignore                          |   1 -
 real/compress2/Main.hs              |   8 ++++++--
 real/compress2/Makefile             |  12 +++---------
 real/compress2/compress2.faststdout | Bin 44152 -> 20 bytes
 real/compress2/compress2.stdout     |   1 +
 5 files changed, 10 insertions(+), 12 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..592c00a 100644
--- a/real/compress2/Main.hs
+++ b/real/compress2/Main.hs
@@ -8,12 +8,16 @@ 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..3a81e95 100644
--- a/real/compress2/Makefile
+++ b/real/compress2/Makefile
@@ -1,23 +1,17 @@
 TOP = ../..
 include $(TOP)/mk/boilerplate.mk
 
-SRC_RUNTEST_OPTS += -stdout-binary
-
 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..5c949b3
--- /dev/null
+++ b/real/compress2/compress2.stdout
@@ -0,0 +1 @@
+8522868473445645791



More information about the ghc-commits mailing list