[commit: ghc] ghc-8.0: Don't print "Loaded GHCi configuration" message in ghc -e (#11478) (70f01d0)
git at git.haskell.org
git at git.haskell.org
Mon Jan 25 15:57:18 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : ghc-8.0
Link : http://ghc.haskell.org/trac/ghc/changeset/70f01d0ec4953eff985c856f5c9c3179e96fa8eb/ghc
>---------------------------------------------------------------
commit 70f01d0ec4953eff985c856f5c9c3179e96fa8eb
Author: Reid Barton <rwbarton at gmail.com>
Date: Fri Jan 22 09:59:20 2016 -0500
Don't print "Loaded GHCi configuration" message in ghc -e (#11478)
Summary:
Also don't print it if the user specifically requested
non-verbose output with -v0.
Since this means there is no longer any test that checks
for the message, add such a test.
Test Plan: validate
Reviewers: austin, bgamari
Reviewed By: bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1817
GHC Trac Issues: #11478
(cherry picked from commit 9048c3dfee1c7c9171114c349714095b3abcc47a)
>---------------------------------------------------------------
70f01d0ec4953eff985c856f5c9c3179e96fa8eb
ghc/GHCi/UI.hs | 6 +++++-
testsuite/tests/ghc-e/should_run/Makefile | 4 ++++
.../tests/ghc-e/should_run/T11478.script | 0
.../4876.stdout => testsuite/tests/ghc-e/should_run/T11478.stdout | 0
testsuite/tests/ghc-e/should_run/all.T | 1 +
testsuite/tests/ghci/scripts/Makefile | 7 +++++++
testsuite/tests/ghci/scripts/T10408.stdout | 2 --
.../IO/T4144.stdout => testsuite/tests/ghci/scripts/T11389.script | 0
testsuite/tests/ghci/scripts/T11389.stdout | 1 +
testsuite/tests/ghci/scripts/all.T | 2 ++
10 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/ghc/GHCi/UI.hs b/ghc/GHCi/UI.hs
index 30e70e0..fc03b5f 100644
--- a/ghc/GHCi/UI.hs
+++ b/ghc/GHCi/UI.hs
@@ -527,7 +527,11 @@ runGHCi paths maybe_exprs = do
do runInputTWithPrefs defaultPrefs defaultSettings $
runCommands $ fileLoop hdl
liftIO (hClose hdl `catchIO` \_ -> return ())
- liftIO $ putStrLn ("Loaded GHCi configuration from " ++ file)
+ -- Don't print a message if this is really ghc -e (#11478).
+ -- Also, let the user silence the message with -v0
+ -- (the default verbosity in GHCi is 1).
+ when (isNothing maybe_exprs && verbosity dflags > 0) $
+ liftIO $ putStrLn ("Loaded GHCi configuration from " ++ file)
--
diff --git a/testsuite/tests/ghc-e/should_run/Makefile b/testsuite/tests/ghc-e/should_run/Makefile
index 54ce8a3..c98b98a 100644
--- a/testsuite/tests/ghc-e/should_run/Makefile
+++ b/testsuite/tests/ghc-e/should_run/Makefile
@@ -41,3 +41,7 @@ T9905:
T9905b:
'$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -e "import qualified Data.List as L" -e "L.sort [2,1]"
+
+# Ensure that ghc -e does not output extra messages about GHCi configuration files
+T11478:
+ '$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -ghci-script T11478.script -e 3
diff --git a/libraries/base/tests/IO/misc001.stdout b/testsuite/tests/ghc-e/should_run/T11478.script
similarity index 100%
copy from libraries/base/tests/IO/misc001.stdout
copy to testsuite/tests/ghc-e/should_run/T11478.script
diff --git a/libraries/base/tests/Concurrent/4876.stdout b/testsuite/tests/ghc-e/should_run/T11478.stdout
similarity index 100%
copy from libraries/base/tests/Concurrent/4876.stdout
copy to testsuite/tests/ghc-e/should_run/T11478.stdout
diff --git a/testsuite/tests/ghc-e/should_run/all.T b/testsuite/tests/ghc-e/should_run/all.T
index dcb7207..ae28653 100644
--- a/testsuite/tests/ghc-e/should_run/all.T
+++ b/testsuite/tests/ghc-e/should_run/all.T
@@ -16,3 +16,4 @@ test('T7299', req_interp, run_command, ['$MAKE --no-print-directory -s T7299'])
test('T9086', req_interp, run_command, ['$MAKE --no-print-directory -s T9086'])
test('T9905', req_interp, run_command, ['$MAKE --no-print-directory -s T9905'])
test('T9905b', req_interp, run_command, ['$MAKE --no-print-directory -s T9905b'])
+test('T11478', req_interp, run_command, ['$MAKE --no-print-directory -s T11478'])
diff --git a/testsuite/tests/ghci/scripts/Makefile b/testsuite/tests/ghci/scripts/Makefile
index 017555b..0b70318 100644
--- a/testsuite/tests/ghci/scripts/Makefile
+++ b/testsuite/tests/ghci/scripts/Makefile
@@ -54,3 +54,10 @@ T10408:
# and not be ignored when `-ignore-dot-ghci` is specified.
'$(TEST_HC)' $(TEST_HC_OPTS) --interactive -v0 -ignore-dot-ghci \
-ghci-script T10408A.script -ghci-script T10408B.script < /dev/null
+
+.PHONY: T11389
+T11389:
+ # Test that "Loaded GHCi configuration" message is printed by default
+ # (without -v0)
+ '$(TEST_HC)' $(TEST_HC_OPTS) --interactive -ignore-dot-ghci \
+ -ghci-script T11389.script < /dev/null | grep 'configuration'
diff --git a/testsuite/tests/ghci/scripts/T10408.stdout b/testsuite/tests/ghci/scripts/T10408.stdout
index cef83bc..b13d0a4 100644
--- a/testsuite/tests/ghci/scripts/T10408.stdout
+++ b/testsuite/tests/ghci/scripts/T10408.stdout
@@ -1,4 +1,2 @@
"T10408A"
-Loaded GHCi configuration from T10408A.script
"T10408B"
-Loaded GHCi configuration from T10408B.script
diff --git a/libraries/base/tests/IO/T4144.stdout b/testsuite/tests/ghci/scripts/T11389.script
similarity index 100%
copy from libraries/base/tests/IO/T4144.stdout
copy to testsuite/tests/ghci/scripts/T11389.script
diff --git a/testsuite/tests/ghci/scripts/T11389.stdout b/testsuite/tests/ghci/scripts/T11389.stdout
new file mode 100644
index 0000000..c92bf91
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/T11389.stdout
@@ -0,0 +1 @@
+Loaded GHCi configuration from T11389.script
diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T
index 17bee5f..d954899 100755
--- a/testsuite/tests/ghci/scripts/all.T
+++ b/testsuite/tests/ghci/scripts/all.T
@@ -240,3 +240,5 @@ test('T10576b', expect_broken(10576), ghci_script, ['T10576b.script'])
test('T11051a', normal, ghci_script, ['T11051a.script'])
test('T11051b', normal, ghci_script, ['T11051b.script'])
test('T11266', check_stdout(lambda *args: 1), ghci_script, ['T11266.script'])
+
+test('T11389', req_interp, run_command, ['$MAKE -s --no-print-directory T11389'])
More information about the ghc-commits
mailing list