summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authornineonine <mail4chemik@gmail.com>2020-11-14 23:29:00 -0800
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-12-17 13:55:59 -0500
commit09f2839086d43483066e45fe15bb7a0b39f8d1dc (patch)
tree7dc64ab6b75a4cdf19c0553796a143e927337b13 /testsuite
parent80df2edd1b28dc211a894ab7c4faf1c8a0c92fcb (diff)
downloadhaskell-09f2839086d43483066e45fe15bb7a0b39f8d1dc.tar.gz
Force module recompilation if '*' prefix was used to load modules in ghci (#8042)
Usually pre-compiled code is preferred to be loaded in ghci if available, which means that if we try to load module with '*' prefix and compilation artifacts are available on disc (.o and .hi files) or the source code was untouched, the driver would think no recompilation is required. Therefore, we need to force recompilation so that desired byte-code is generated and loaded. Forcing in this case should be ok, since this is what happens for interpreted code anyways when reloading modules.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/ghci/scripts/T8042recomp.script7
-rw-r--r--testsuite/tests/ghci/scripts/T8042recomp.stdout6
-rwxr-xr-xtestsuite/tests/ghci/scripts/all.T1
3 files changed, 14 insertions, 0 deletions
diff --git a/testsuite/tests/ghci/scripts/T8042recomp.script b/testsuite/tests/ghci/scripts/T8042recomp.script
new file mode 100644
index 0000000000..d8fa2b54cc
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/T8042recomp.script
@@ -0,0 +1,7 @@
+:set -v1
+System.IO.writeFile "T8042B.hs" "module T8042B where { fooB = \"T8042B\"; }"
+System.IO.writeFile "T8042A.hs" "module T8042A where { import T8042B; run = putStrLn fooB }"
+:set -fobject-code
+:load T8042A
+:load *T8042A
+:break run
diff --git a/testsuite/tests/ghci/scripts/T8042recomp.stdout b/testsuite/tests/ghci/scripts/T8042recomp.stdout
new file mode 100644
index 0000000000..49250577dc
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/T8042recomp.stdout
@@ -0,0 +1,6 @@
+[1 of 2] Compiling T8042B ( T8042B.hs, T8042B.o )
+[2 of 2] Compiling T8042A ( T8042A.hs, T8042A.o )
+Ok, two modules loaded.
+[2 of 2] Compiling T8042A ( T8042A.hs, interpreted )
+Ok, two modules loaded.
+Breakpoint 0 activated at T8042A.hs:1:44-56
diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T
index 29b01a0b0c..6fec18bd92 100755
--- a/testsuite/tests/ghci/scripts/all.T
+++ b/testsuite/tests/ghci/scripts/all.T
@@ -175,6 +175,7 @@ test('T7873', normal, ghci_script, ['T7873.script'])
test('T7939', normal, ghci_script, ['T7939.script'])
test('T7894', normal, ghci_script, ['T7894.script'])
test('T8042', normal, ghci_script, ['T8042.script'])
+test('T8042recomp', normal, ghci_script, ['T8042recomp.script'])
test('T8116', normal, ghci_script, ['T8116.script'])
test('T8113', normal, ghci_script, ['T8113.script'])
test('T8172', when(opsys('mingw32'), normalise_drive_letter),