summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2021-04-12 18:09:03 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-04-18 11:09:32 -0400
commit40d2843686ecb08f9fce8691b833ba6517cfc6ec (patch)
tree9adf93b03ad0806620c117746a2564475dc91350 /testsuite
parentc71b220491a6ae46924cc5011b80182bcc773a58 (diff)
downloadhaskell-40d2843686ecb08f9fce8691b833ba6517cfc6ec.tar.gz
Only load package environment file once when starting GHCi
Since d880d6b2e48268f5ed4d3eb751fe24cc833e9221 the parsing of the environment files was moved to `parseDynamicFlags`, under the assumption it was typically only called once. It turns out not to be true in GHCi and this led to continually reparsing the environment file whenever a new option was set, the options were appended to the package state and hence all packages reloaded, as it looked like the options were changed. The simplest fix seems to be a clearer specification: > Package environment files are only loaded in GHCi during initialisation. Fixes #19650
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/ghci/scripts/Makefile4
-rw-r--r--testsuite/tests/ghci/scripts/T19650.script1
-rw-r--r--testsuite/tests/ghci/scripts/T19650.stdout1
-rwxr-xr-xtestsuite/tests/ghci/scripts/all.T8
4 files changed, 14 insertions, 0 deletions
diff --git a/testsuite/tests/ghci/scripts/Makefile b/testsuite/tests/ghci/scripts/Makefile
index 40ba561f69..a76b8c090c 100644
--- a/testsuite/tests/ghci/scripts/Makefile
+++ b/testsuite/tests/ghci/scripts/Makefile
@@ -66,3 +66,7 @@ T11389:
T12023:
-'$(TEST_HC)' $(TEST_HC_OPTS_INTERACTIVE) \
-ghci-script T12023.script < /dev/null | grep -c -E '(~#|~R#|~P#)'
+
+.PHONY: T19650_setup
+T19650_setup:
+ '$(GHC_PKG)' latest base > my_package_env
diff --git a/testsuite/tests/ghci/scripts/T19650.script b/testsuite/tests/ghci/scripts/T19650.script
new file mode 100644
index 0000000000..1426870840
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/T19650.script
@@ -0,0 +1 @@
+:set -DMAGIC
diff --git a/testsuite/tests/ghci/scripts/T19650.stdout b/testsuite/tests/ghci/scripts/T19650.stdout
new file mode 100644
index 0000000000..4bca5be26b
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/T19650.stdout
@@ -0,0 +1 @@
+Loaded package environment from my_package_env
diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T
index bc8de5e5a0..bf0124a23a 100755
--- a/testsuite/tests/ghci/scripts/all.T
+++ b/testsuite/tests/ghci/scripts/all.T
@@ -330,3 +330,11 @@ test('T19279', normal, ghci_script, ['T19279.script'])
test('T19310', normal, ghci_script, ['T19310.script'])
test('T19667Ghci', extra_files(['T19667Ghci.hs']), ghci_script, ['T19667Ghci.script'])
test('T19688', normal, ghci_script, ['T19688.script'])
+test('T19650',
+ [ pre_cmd('$MAKE -s --no-print-directory T19650_setup'),
+ extra_hc_opts('-package-env my_package_env -v1'),
+ # Should only appear once
+ filter_stdout_lines(r'Loaded package env.*')
+ ],
+ ghci_script,
+ ['T19650.script'])