[Git][ghc/ghc][wip/24107] testsuite: add test for #24118 and #24107

Zubin (@wz1000) gitlab at gitlab.haskell.org
Fri Dec 1 11:21:41 UTC 2023



Zubin pushed to branch wip/24107 at Glasgow Haskell Compiler / GHC


Commits:
dd7ac68f by Zubin Duggal at 2023-12-01T16:51:34+05:30
testsuite: add test for #24118 and #24107

MultiLayerModulesDefsGhci was not able to catch the leak because it uses
:l which discards the previous environment.

Using :r catches both of these leaks

- - - - -


3 changed files:

- + testsuite/tests/perf/compiler/MultiLayerModulesDefsGhciReload.script
- testsuite/tests/perf/compiler/all.T
- + testsuite/tests/perf/compiler/genMultiLayerModulesDefsReload


Changes:

=====================================
testsuite/tests/perf/compiler/MultiLayerModulesDefsGhciReload.script
=====================================
@@ -0,0 +1,4 @@
+:set -fforce-recomp
+:l MultiLayerModules.hs
+:r
+:r


=====================================
testsuite/tests/perf/compiler/all.T
=====================================
@@ -392,6 +392,19 @@ test('MultiLayerModulesDefsGhci',
      ghci_script,
      ['MultiLayerModulesDefsGhci.script'])
 
+test('MultiLayerModulesDefsGhciReload',
+     [ collect_compiler_residency(15),
+       pre_cmd('./genMultiLayerModulesDefsReload'),
+       extra_files(['genMultiLayerModulesDefsReload']),
+       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,
+     ['MultiLayerModulesDefsGhciReload.script'])
+
 test('InstanceMatching',
      [ collect_compiler_stats('bytes allocated',3),
        pre_cmd('$MAKE -s --no-print-directory InstanceMatching'),


=====================================
testsuite/tests/perf/compiler/genMultiLayerModulesDefsReload
=====================================
@@ -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



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/dd7ac68f6002943af7311b8daba76cc8e75d7b02

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/dd7ac68f6002943af7311b8daba76cc8e75d7b02
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20231201/8a52e63b/attachment-0001.html>


More information about the ghc-commits mailing list