Commit 445a7da9 authored by Edward Z. Yang's avatar Edward Z. Yang
Browse files

Deduplicate common.sh to single copy, part 2 of #3296


Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
parent 00ed3bb5
......@@ -30,80 +30,70 @@ Extra-Source-Files:
-- Generated with '../Cabal/misc/gen-extra-source-files.sh'
-- Do NOT edit this section manually; instead, run the script.
-- BEGIN gen-extra-source-files
tests/IntegrationTests/custom/common.sh
tests/IntegrationTests/custom/should_run/plain.err
tests/IntegrationTests/custom/should_run/plain.sh
tests/IntegrationTests/custom/should_run/plain/A.hs
tests/IntegrationTests/custom/should_run/plain/Setup.hs
tests/IntegrationTests/custom/should_run/plain/plain.cabal
tests/IntegrationTests/exec/common.sh
tests/IntegrationTests/exec/should_fail/exit_with_failure_without_args.err
tests/IntegrationTests/exec/should_fail/exit_with_failure_without_args.sh
tests/IntegrationTests/exec/should_run/Foo.hs
tests/IntegrationTests/exec/should_run/My.hs
tests/IntegrationTests/exec/should_run/adds_sandbox_bin_directory_to_path.out
tests/IntegrationTests/exec/should_run/adds_sandbox_bin_directory_to_path.sh
tests/IntegrationTests/exec/should_run/auto_configures_on_exec.out
tests/IntegrationTests/exec/should_run/auto_configures_on_exec.sh
tests/IntegrationTests/exec/should_run/can_run_executables_installed_in_sandbox.out
tests/IntegrationTests/exec/should_run/can_run_executables_installed_in_sandbox.sh
tests/IntegrationTests/exec/should_run/configures_cabal_to_use_sandbox.sh
tests/IntegrationTests/exec/should_run/configures_ghc_to_use_sandbox.sh
tests/IntegrationTests/exec/should_run/my.cabal
tests/IntegrationTests/exec/should_run/runs_given_command.out
tests/IntegrationTests/exec/should_run/runs_given_command.sh
tests/IntegrationTests/freeze/common.sh
tests/IntegrationTests/freeze/should_run/disable_benchmarks_freezes_bench_deps.sh
tests/IntegrationTests/freeze/should_run/disable_tests_freezes_test_deps.sh
tests/IntegrationTests/freeze/should_run/does_not_freeze_nondeps.sh
tests/IntegrationTests/freeze/should_run/does_not_freeze_self.sh
tests/IntegrationTests/freeze/should_run/dry_run_does_not_create_config.sh
tests/IntegrationTests/freeze/should_run/enable_benchmarks_freezes_bench_deps.sh
tests/IntegrationTests/freeze/should_run/enable_tests_freezes_test_deps.sh
tests/IntegrationTests/freeze/should_run/freezes_direct_dependencies.sh
tests/IntegrationTests/freeze/should_run/freezes_transitive_dependencies.sh
tests/IntegrationTests/freeze/should_run/my.cabal
tests/IntegrationTests/freeze/should_run/runs_without_error.sh
tests/IntegrationTests/internal-libs/common.sh
tests/IntegrationTests/internal-libs/should_run/internal_lib_basic.sh
tests/IntegrationTests/internal-libs/should_run/internal_lib_shadow.sh
tests/IntegrationTests/internal-libs/should_run/p/Foo.hs
tests/IntegrationTests/internal-libs/should_run/p/p.cabal
tests/IntegrationTests/internal-libs/should_run/p/p/P.hs
tests/IntegrationTests/internal-libs/should_run/p/q/Q.hs
tests/IntegrationTests/internal-libs/should_run/q/Q.hs
tests/IntegrationTests/internal-libs/should_run/q/q.cabal
tests/IntegrationTests/manpage/common.sh
tests/IntegrationTests/manpage/should_run/outputs_manpage.sh
tests/IntegrationTests/multiple-source/common.sh
tests/IntegrationTests/multiple-source/should_run/finds_second_source_of_multiple_source.sh
tests/IntegrationTests/multiple-source/should_run/p/Setup.hs
tests/IntegrationTests/multiple-source/should_run/p/p.cabal
tests/IntegrationTests/multiple-source/should_run/q/Setup.hs
tests/IntegrationTests/multiple-source/should_run/q/q.cabal
tests/IntegrationTests/sandbox-sources/common.sh
tests/IntegrationTests/sandbox-sources/should_fail/fail_removing_source_thats_not_registered.err
tests/IntegrationTests/sandbox-sources/should_fail/fail_removing_source_thats_not_registered.sh
tests/IntegrationTests/sandbox-sources/should_fail/p/Setup.hs
tests/IntegrationTests/sandbox-sources/should_fail/p/p.cabal
tests/IntegrationTests/sandbox-sources/should_fail/q/Setup.hs
tests/IntegrationTests/sandbox-sources/should_fail/q/q.cabal
tests/IntegrationTests/sandbox-sources/should_run/p/Setup.hs
tests/IntegrationTests/sandbox-sources/should_run/p/p.cabal
tests/IntegrationTests/sandbox-sources/should_run/q/Setup.hs
tests/IntegrationTests/sandbox-sources/should_run/q/q.cabal
tests/IntegrationTests/sandbox-sources/should_run/remove_nonexistent_source.sh
tests/IntegrationTests/sandbox-sources/should_run/report_success_removing_source.out
tests/IntegrationTests/sandbox-sources/should_run/report_success_removing_source.sh
tests/IntegrationTests/common.sh
tests/IntegrationTests/custom/plain.err
tests/IntegrationTests/custom/plain.sh
tests/IntegrationTests/custom/plain/A.hs
tests/IntegrationTests/custom/plain/Setup.hs
tests/IntegrationTests/custom/plain/plain.cabal
tests/IntegrationTests/exec/Foo.hs
tests/IntegrationTests/exec/My.hs
tests/IntegrationTests/exec/adds_sandbox_bin_directory_to_path.out
tests/IntegrationTests/exec/adds_sandbox_bin_directory_to_path.sh
tests/IntegrationTests/exec/auto_configures_on_exec.out
tests/IntegrationTests/exec/auto_configures_on_exec.sh
tests/IntegrationTests/exec/can_run_executables_installed_in_sandbox.out
tests/IntegrationTests/exec/can_run_executables_installed_in_sandbox.sh
tests/IntegrationTests/exec/configures_cabal_to_use_sandbox.sh
tests/IntegrationTests/exec/configures_ghc_to_use_sandbox.sh
tests/IntegrationTests/exec/exit_with_failure_without_args.err
tests/IntegrationTests/exec/exit_with_failure_without_args.sh
tests/IntegrationTests/exec/my.cabal
tests/IntegrationTests/exec/runs_given_command.out
tests/IntegrationTests/exec/runs_given_command.sh
tests/IntegrationTests/freeze/disable_benchmarks_freezes_bench_deps.sh
tests/IntegrationTests/freeze/disable_tests_freezes_test_deps.sh
tests/IntegrationTests/freeze/does_not_freeze_nondeps.sh
tests/IntegrationTests/freeze/does_not_freeze_self.sh
tests/IntegrationTests/freeze/dry_run_does_not_create_config.sh
tests/IntegrationTests/freeze/enable_benchmarks_freezes_bench_deps.sh
tests/IntegrationTests/freeze/enable_tests_freezes_test_deps.sh
tests/IntegrationTests/freeze/freezes_direct_dependencies.sh
tests/IntegrationTests/freeze/freezes_transitive_dependencies.sh
tests/IntegrationTests/freeze/my.cabal
tests/IntegrationTests/freeze/runs_without_error.sh
tests/IntegrationTests/internal-libs/internal_lib_basic.sh
tests/IntegrationTests/internal-libs/internal_lib_shadow.sh
tests/IntegrationTests/internal-libs/p/Foo.hs
tests/IntegrationTests/internal-libs/p/p.cabal
tests/IntegrationTests/internal-libs/p/p/P.hs
tests/IntegrationTests/internal-libs/p/q/Q.hs
tests/IntegrationTests/internal-libs/q/Q.hs
tests/IntegrationTests/internal-libs/q/q.cabal
tests/IntegrationTests/manpage/outputs_manpage.sh
tests/IntegrationTests/multiple-source/finds_second_source_of_multiple_source.sh
tests/IntegrationTests/multiple-source/p/Setup.hs
tests/IntegrationTests/multiple-source/p/p.cabal
tests/IntegrationTests/multiple-source/q/Setup.hs
tests/IntegrationTests/multiple-source/q/q.cabal
tests/IntegrationTests/sandbox-sources/fail_removing_source_thats_not_registered.err
tests/IntegrationTests/sandbox-sources/fail_removing_source_thats_not_registered.sh
tests/IntegrationTests/sandbox-sources/p/Setup.hs
tests/IntegrationTests/sandbox-sources/p/p.cabal
tests/IntegrationTests/sandbox-sources/q/Setup.hs
tests/IntegrationTests/sandbox-sources/q/q.cabal
tests/IntegrationTests/sandbox-sources/remove_nonexistent_source.sh
tests/IntegrationTests/sandbox-sources/report_success_removing_source.out
tests/IntegrationTests/sandbox-sources/report_success_removing_source.sh
tests/IntegrationTests/user-config/common.sh
tests/IntegrationTests/user-config/should_fail/doesnt_overwrite_without_f.err
tests/IntegrationTests/user-config/should_fail/doesnt_overwrite_without_f.sh
tests/IntegrationTests/user-config/should_run/overwrites_with_f.out
tests/IntegrationTests/user-config/should_run/overwrites_with_f.sh
tests/IntegrationTests/user-config/should_run/runs_without_error.out
tests/IntegrationTests/user-config/should_run/runs_without_error.sh
tests/IntegrationTests/user-config/should_run/uses_CABAL_CONFIG.out
tests/IntegrationTests/user-config/should_run/uses_CABAL_CONFIG.sh
tests/IntegrationTests/user-config/doesnt_overwrite_without_f.err
tests/IntegrationTests/user-config/doesnt_overwrite_without_f.sh
tests/IntegrationTests/user-config/overwrites_with_f.out
tests/IntegrationTests/user-config/overwrites_with_f.sh
tests/IntegrationTests/user-config/runs_without_error.out
tests/IntegrationTests/user-config/runs_without_error.sh
tests/IntegrationTests/user-config/uses_CABAL_CONFIG.out
tests/IntegrationTests/user-config/uses_CABAL_CONFIG.sh
-- END gen-extra-source-files
source-repository head
......
......@@ -20,7 +20,7 @@ import Distribution.Simple.Program.Find
import Distribution.Simple.Program.Types
( Program(..), simpleProgram, programPath)
import Distribution.Simple.Setup ( Flag(..) )
import Distribution.Simple.Utils ( findProgramVersion, copyDirectoryRecursive )
import Distribution.Simple.Utils ( findProgramVersion, copyDirectoryRecursive, installOrdinaryFile )
import Distribution.Verbosity (normal)
-- Third party modules.
......@@ -257,6 +257,11 @@ runTestCase tc = do
copyDirectoryRecursive normal
(tcBaseDirectory tc </> tcCategory tc)
workDirectory
-- Copy in the common.sh stub
let commonDest = workDirectory </> "common.sh"
e <- doesFileExist commonDest
unless e $
installOrdinaryFile normal (tcBaseDirectory tc </> "common.sh") commonDest
-- Done
return workDirectory
removeWorkDirectory doRemove workDirectory = do
......
# A globally available set of useful utilities. Test
# scripts can include this by saying ". ./common.sh"
# Helper to run Cabal
cabal() {
"$CABAL" $CABAL_ARGS "$@"
......
# Helper to run Cabal
cabal() {
"$CABAL" $CABAL_ARGS "$@"
}
die() {
echo "die: $@"
exit 1
}
# Helper to run Cabal
cabal() {
"$CABAL" $CABAL_ARGS "$@"
}
die() {
echo "die: $@"
exit 1
}
cabal() {
"$CABAL" $CABAL_ARGS "$@"
}
die() {
echo "die: $@"
exit 1
}
# Helper to run Cabal
cabal() {
"$CABAL" $CABAL_ARGS "$@"
}
die() {
echo "die: $@"
exit 1
}
cabal() {
"$CABAL" $CABAL_ARGS "$@"
}
die() {
echo "die: $@"
exit 1
}
cabal() {
"$CABAL" $CABAL_ARGS "$@"
}
die() {
echo "die: $@"
exit 1
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment