diff options
author | Moritz Angermann <moritz.angermann@gmail.com> | 2019-01-30 09:47:20 +0800 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-02-28 02:20:05 -0500 |
commit | f838809f1e73c20bc70926fe98e735297572ac60 (patch) | |
tree | 8369ec06977939219970bbc2f2f63814253d1498 /testsuite/tests/iserv-remote | |
parent | 2e8f664957dc3763dc4375894b8dc4d046d2e95b (diff) | |
download | haskell-f838809f1e73c20bc70926fe98e735297572ac60.tar.gz |
Cleanup iserv/iserv-proxy
This adds trace messages that include the processes name and as such
make debugging and following the communication easier.
It also adds a note regarding the fwd*Call proxy-communication logic
between the proxy and the slave.
The proxy will now also poll for 60s to wait for the remote iserv
to come up. (Alternatively you can start the remote process
beforehand; and just have iserv-proxy connect to it)
Diffstat (limited to 'testsuite/tests/iserv-remote')
-rw-r--r-- | testsuite/tests/iserv-remote/Lib.hs | 7 | ||||
-rw-r--r-- | testsuite/tests/iserv-remote/Main.hs | 5 | ||||
-rw-r--r-- | testsuite/tests/iserv-remote/Makefile | 38 | ||||
-rw-r--r-- | testsuite/tests/iserv-remote/Setup.hs | 2 | ||||
-rw-r--r-- | testsuite/tests/iserv-remote/all.T | 11 | ||||
-rw-r--r-- | testsuite/tests/iserv-remote/iserv-remote.stderr | 1 | ||||
-rw-r--r-- | testsuite/tests/iserv-remote/iserv-remote.stdout | 1 | ||||
-rwxr-xr-x | testsuite/tests/iserv-remote/iserv-wrapper | 12 | ||||
-rw-r--r-- | testsuite/tests/iserv-remote/remote-iserv.stderr | 2 | ||||
-rw-r--r-- | testsuite/tests/iserv-remote/remote-iserv.stdout | 4 |
10 files changed, 83 insertions, 0 deletions
diff --git a/testsuite/tests/iserv-remote/Lib.hs b/testsuite/tests/iserv-remote/Lib.hs new file mode 100644 index 0000000000..f34fc9d8ab --- /dev/null +++ b/testsuite/tests/iserv-remote/Lib.hs @@ -0,0 +1,7 @@ +{-# LANGUAGE TemplateHaskell #-} +module Lib where + +import Language.Haskell.TH + +x :: Int -> ExpQ +x n = [| 3 + n |] diff --git a/testsuite/tests/iserv-remote/Main.hs b/testsuite/tests/iserv-remote/Main.hs new file mode 100644 index 0000000000..dcc2354287 --- /dev/null +++ b/testsuite/tests/iserv-remote/Main.hs @@ -0,0 +1,5 @@ +{-# LANGUAGE TemplateHaskell #-} + +import Lib (x) + +main = putStrLn "Hello World" >> print $(x 10) diff --git a/testsuite/tests/iserv-remote/Makefile b/testsuite/tests/iserv-remote/Makefile new file mode 100644 index 0000000000..409e33be09 --- /dev/null +++ b/testsuite/tests/iserv-remote/Makefile @@ -0,0 +1,38 @@ +TOP=../.. +include $(TOP)/mk/boilerplate.mk +include $(TOP)/mk/test.mk + +SETUP='$(PWD)/Setup' -v0 +CONFIGURE=$(SETUP) configure $(CABAL_MINIMAL_BUILD) --with-ghc='$(TEST_HC)' --ghc-options='$(TEST_HC_OPTS)' --package-db='$(PWD)/tmp.d' --prefix='$(PWD)/inst' + +remote-iserv: clean + '$(GHC_PKG)' init tmp.d + + '$(TEST_HC)' $(TEST_HC_OPTS) -v0 --make Setup + + cp -r $(TOP)/../libraries/libiserv . + cd libiserv && $(CONFIGURE) -fnetwork + cd libiserv && $(SETUP) build + cd libiserv && $(SETUP) copy + cd libiserv && $(SETUP) register + + cp -r $(TOP)/../utils/iserv-proxy . + cd iserv-proxy && $(CONFIGURE) + cd iserv-proxy && $(SETUP) build + cd iserv-proxy && $(SETUP) copy + cd iserv-proxy && $(SETUP) register + + cp -r $(TOP)/../utils/remote-iserv . + cd remote-iserv && $(CONFIGURE) + cd remote-iserv && $(SETUP) build + cd remote-iserv && $(SETUP) copy + cd remote-iserv && $(SETUP) register + + '$(TEST_HC)' $(TEST_HC_OPTS) -fexternal-interpreter -pgmi $(PWD)/iserv-wrapper Main.hs + +ifneq "$(CLEANUP)" "" + $(MAKE) -s --no-print-directory clean +endif + +clean : + $(RM) -rf tmp *.o *.hi Main libiserv iserv-proxy remote-iserv tmp.d inst dist Setup$(exeext) diff --git a/testsuite/tests/iserv-remote/Setup.hs b/testsuite/tests/iserv-remote/Setup.hs new file mode 100644 index 0000000000..9a994af677 --- /dev/null +++ b/testsuite/tests/iserv-remote/Setup.hs @@ -0,0 +1,2 @@ +import Distribution.Simple +main = defaultMain diff --git a/testsuite/tests/iserv-remote/all.T b/testsuite/tests/iserv-remote/all.T new file mode 100644 index 0000000000..f8f0920835 --- /dev/null +++ b/testsuite/tests/iserv-remote/all.T @@ -0,0 +1,11 @@ +def normalise_port(str): + str = re.sub(r'on port [0-9]+', r'on port ****', str) + return str + +test('remote-iserv' + , [ reqlib('network') + , normalise_fun(normalise_port) + , normalise_errmsg_fun(normalise_port) + , extra_files(['Main.hs', 'Lib.hs', 'iserv-wrapper', 'Setup.hs'])] + , makefile_test + , []) diff --git a/testsuite/tests/iserv-remote/iserv-remote.stderr b/testsuite/tests/iserv-remote/iserv-remote.stderr new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/testsuite/tests/iserv-remote/iserv-remote.stderr @@ -0,0 +1 @@ + diff --git a/testsuite/tests/iserv-remote/iserv-remote.stdout b/testsuite/tests/iserv-remote/iserv-remote.stdout new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/testsuite/tests/iserv-remote/iserv-remote.stdout @@ -0,0 +1 @@ + diff --git a/testsuite/tests/iserv-remote/iserv-wrapper b/testsuite/tests/iserv-remote/iserv-wrapper new file mode 100755 index 0000000000..6c7da86214 --- /dev/null +++ b/testsuite/tests/iserv-remote/iserv-wrapper @@ -0,0 +1,12 @@ +#!/bin/bash +PORT=$(($((5000+$RANDOM)) % 10000)) + +(>&2 echo "starting remote-iserv on port $PORT") + +./inst/bin/remote-iserv tmp $PORT & +REMOTE="$!" + +(>&2 echo "starting iserv-proxy with $@") +./inst/bin/iserv-proxy $@ 127.0.0.1 $PORT + +kill $REMOTE diff --git a/testsuite/tests/iserv-remote/remote-iserv.stderr b/testsuite/tests/iserv-remote/remote-iserv.stderr new file mode 100644 index 0000000000..cd6f9d4385 --- /dev/null +++ b/testsuite/tests/iserv-remote/remote-iserv.stderr @@ -0,0 +1,2 @@ +starting remote-iserv on port 2051 +starting iserv-proxy with 13 14 diff --git a/testsuite/tests/iserv-remote/remote-iserv.stdout b/testsuite/tests/iserv-remote/remote-iserv.stdout new file mode 100644 index 0000000000..b062df0c31 --- /dev/null +++ b/testsuite/tests/iserv-remote/remote-iserv.stdout @@ -0,0 +1,4 @@ +[1 of 2] Compiling Lib ( Lib.hs, Lib.o ) +[2 of 2] Compiling Main ( Main.hs, Main.o ) +Listening on port 2051 +Linking Main ... |