[commit: ghc] master: Teach `validate` script how to `--help` (ea87014)

git at git.haskell.org git at git.haskell.org
Sat Aug 31 16:45:10 CEST 2013


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/ea87014a7ad4454f18bb15f6f0ee4b6e61b148be/ghc

>---------------------------------------------------------------

commit ea87014a7ad4454f18bb15f6f0ee4b6e61b148be
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date:   Sat Aug 31 16:42:06 2013 +0200

    Teach `validate` script how to `--help`
    
    This basically turns the comment at the beginning of the `validate`
    shell script into an interactive `--help` output plus some minor additions.


>---------------------------------------------------------------

ea87014a7ad4454f18bb15f6f0ee4b6e61b148be
 validate |   50 +++++++++++++++++++++++++++++++++++---------------
 1 file changed, 35 insertions(+), 15 deletions(-)

diff --git a/validate b/validate
index 170bb2d..95425d3 100755
--- a/validate
+++ b/validate
@@ -1,21 +1,37 @@
 #!/bin/sh
 
-# Flags:
-#   --no-clean:       don't make clean first, just carry on from
-#                     a previous interrupted validation run
-#   --testsuite-only: don't build the compiler, just run
-#                     the test suite
-#   --hpc:            build stage2 with -fhpc, and see how much of the
-#                     compiler the test suite covers.
-#                     2008-07-01: 63% slower than the default.
-#                     HTML generated here: testsuite/hpc_output/hpc_index.html
-#   --normal:         Default settings
-#   --fast:           Omit dyn way, omit binary distribution
-#   --slow:           Build stage2 with -DDEBUG.
-#                     2008-07-01: 14% slower than the default.
-
 set -e
 
+show_help () {
+    cat <<EOF
+Usage: $0 [FLAGS]...
+
+Validate GHC source tree against testsuite; see
+http://ghc.haskell.org/trac/ghc/wiki/TestingPatches for more
+information.
+
+Flags:
+  --no-clean        don't make clean first, just carry on from
+                    a previous interrupted validation run
+  --testsuite-only  don't build the compiler, just run the test suite
+  --hpc             build stage2 with -fhpc, and see how much of the
+                    compiler the test suite covers.
+                    2008-07-01: 63% slower than the default.
+                    HTML generated here: testsuite/hpc_output/hpc_index.html
+  --normal          Default settings
+  --fast            Omit dyn way, omit binary distribution
+  --slow            Build stage2 with -DDEBUG.
+                    2008-07-01: 14% slower than the default.
+  --help            shows this usage help.
+
+  Set environment variable 'CPUS' to number of cores, to exploit
+  multiple cpu cores, e.g.
+
+    CPUS=8 ./validate
+
+EOF
+}
+
 no_clean=0
 testsuite_only=0
 hpc=NO
@@ -42,8 +58,12 @@ do
     --normal)
         speed=NORMAL
         ;;
+    --help)
+        show_help
+        exit 0;;
     *)
-        echo "Bad argument: $1" >&2
+        echo "$0: unrecognized argument '$1'" >&2
+        echo "Try '$0 --help' for more information." >&2
         exit 1;;
     esac
     shift





More information about the ghc-commits mailing list