summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2021-10-15 09:41:25 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-10-19 03:31:27 -0400
commitcfacac68970c4bcc632a25b641c89d331cd1a9f3 (patch)
tree183fed2f1814dfa8f2d71247e92938dd6d1feda9 /testsuite
parent877e6685e3d802f159b1d9db785bc663a37c31cb (diff)
downloadhaskell-cfacac68970c4bcc632a25b641c89d331cd1a9f3.tar.gz
Add performance test for ghci, -fno-code and reloading (#20509)
This test triggers the bad code path identified by #20509 where an entry into the EPS caused by importing Control.Applicative will retain a stale HomePackageTable.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/perf/compiler/MultiLayerModulesNoCode.script3
-rw-r--r--testsuite/tests/perf/compiler/all.T13
-rwxr-xr-xtestsuite/tests/perf/compiler/genMultiLayerModulesNoCode32
3 files changed, 48 insertions, 0 deletions
diff --git a/testsuite/tests/perf/compiler/MultiLayerModulesNoCode.script b/testsuite/tests/perf/compiler/MultiLayerModulesNoCode.script
new file mode 100644
index 0000000000..dba747c630
--- /dev/null
+++ b/testsuite/tests/perf/compiler/MultiLayerModulesNoCode.script
@@ -0,0 +1,3 @@
+:set -fno-code
+:l MultiLayerModules.hs
+:l MultiLayerModules.hs
diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T
index b61ba25478..9f726cc755 100644
--- a/testsuite/tests/perf/compiler/all.T
+++ b/testsuite/tests/perf/compiler/all.T
@@ -306,6 +306,19 @@ test('MultiLayerModulesDefsGhci',
ghci_script,
['MultiLayerModulesDefsGhci.script'])
+test('MultiLayerModulesNoCode',
+ [ collect_compiler_residency(15),
+ pre_cmd('./genMultiLayerModulesNoCode'),
+ extra_files(['genMultiLayerModulesNoCode']),
+ 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,
+ ['MultiLayerModulesNoCode.script'])
+
test('ManyConstructors',
[ collect_compiler_stats('bytes allocated',2),
pre_cmd('./genManyConstructors'),
diff --git a/testsuite/tests/perf/compiler/genMultiLayerModulesNoCode b/testsuite/tests/perf/compiler/genMultiLayerModulesNoCode
new file mode 100755
index 0000000000..0cca953c30
--- /dev/null
+++ b/testsuite/tests/perf/compiler/genMultiLayerModulesNoCode
@@ -0,0 +1,32 @@
+#!/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;
+ for k in $(seq -w 1 $DEFS); do
+ echo "a_0_${i}_${k} = ${i} + ${k}" >> DummyLevel${l}M$i.hs;
+ done
+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
+# What this import is doesn't matter, as long as it's not from the home package
+# and not already imported implicitly.
+echo "import Control.Applicative" >> MultiLayerModules.hs;