summaryrefslogtreecommitdiff
path: root/testsuite/tests
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2021-10-08 12:13:31 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-10-12 19:17:15 -0400
commitc2ce1b178575abc0cc37a6c232502644c9d863ac (patch)
tree006b164322372a4763b5046c752454f82dc6ef5e /testsuite/tests
parentff0409d0847a24bdbd76c358960c86263b219179 (diff)
downloadhaskell-c2ce1b178575abc0cc37a6c232502644c9d863ac.tar.gz
Add GHCi recompilation performance test
Diffstat (limited to 'testsuite/tests')
-rw-r--r--testsuite/tests/perf/compiler/MultiLayerModulesDefsGhci.script5
-rw-r--r--testsuite/tests/perf/compiler/all.T13
-rwxr-xr-xtestsuite/tests/perf/compiler/genMultiLayerModulesDefs26
3 files changed, 44 insertions, 0 deletions
diff --git a/testsuite/tests/perf/compiler/MultiLayerModulesDefsGhci.script b/testsuite/tests/perf/compiler/MultiLayerModulesDefsGhci.script
new file mode 100644
index 0000000000..e3df435f5d
--- /dev/null
+++ b/testsuite/tests/perf/compiler/MultiLayerModulesDefsGhci.script
@@ -0,0 +1,5 @@
+:l shell.hs
+:def shell (\s -> do shell s; return "")
+:l MultiLayerModules.hs
+:shell find . -name 'Dummy*.hs' -exec sh -c 'echo "" >> {}' \;
+:l MultiLayerModules.hs \ No newline at end of file
diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T
index 6876060978..b61ba25478 100644
--- a/testsuite/tests/perf/compiler/all.T
+++ b/testsuite/tests/perf/compiler/all.T
@@ -293,6 +293,19 @@ test('MultiLayerModulesRecomp',
multimod_compile,
['MultiLayerModules', '-v0'])
+test('MultiLayerModulesDefsGhci',
+ [ collect_compiler_residency(15),
+ pre_cmd('./genMultiLayerModulesDefs'),
+ extra_files(['../../ghci/shell.hs', 'genMultiLayerModulesDefs']),
+ compile_timeout_multiplier(5)
+ # this is _a lot_
+ # but this test has been failing every now and then,
+ # especially on i386. Let's just give it some room
+ # to complete successfully reliably everywhere.
+ ],
+ ghci_script,
+ ['MultiLayerModulesDefsGhci.script'])
+
test('ManyConstructors',
[ collect_compiler_stats('bytes allocated',2),
pre_cmd('./genManyConstructors'),
diff --git a/testsuite/tests/perf/compiler/genMultiLayerModulesDefs b/testsuite/tests/perf/compiler/genMultiLayerModulesDefs
new file mode 100755
index 0000000000..8dd1d92fd9
--- /dev/null
+++ b/testsuite/tests/perf/compiler/genMultiLayerModulesDefs
@@ -0,0 +1,26 @@
+#!/usr/bin/env bash
+# Generate $DEPTH layers of modules with $WIDTH modules on each layer
+# Every module on layer N imports all the modules on layer N-1
+# Each module has $DEFS definitions in
+# MultiLayerModules.hs imports all the modules from the last layer
+DEPTH=3
+WIDTH=3
+DEFS=1000
+for i in $(seq -w 1 $WIDTH); do
+ echo "module DummyLevel0M$i where" > DummyLevel0M$i.hs;
+done
+for l in $(seq 1 $DEPTH); do
+ for i in $(seq -w 1 $WIDTH); do
+ echo "module DummyLevel${l}M$i where" > DummyLevel${l}M$i.hs;
+ for j in $(seq -w 1 $WIDTH); do
+ echo "import DummyLevel$((l-1))M$j" >> DummyLevel${l}M$i.hs;
+ done
+ for k in $(seq -w 1 $DEFS); do
+ echo "a_${l}_${i}_${j}_${k} = ${l} + ${i} + ${j} + ${k}" >> DummyLevel${l}M$i.hs;
+ done
+ done
+done
+echo "module MultiLayerModules where" > MultiLayerModules.hs
+for j in $(seq -w 1 $WIDTH); do
+ echo "import DummyLevel${DEPTH}M$j" >> MultiLayerModules.hs;
+done