|
1 | 1 | #!/bin/sh
|
2 |
| -## Usage |
3 |
| -# |
4 |
| -# COMMANDS |
5 |
| -# |
6 |
| -# ./miri install <flags>: |
7 |
| -# Installs the miri driver and cargo-miri. <flags> are passed to `cargo |
8 |
| -# install`. Sets up the rpath such that the installed binary should work in any |
9 |
| -# working directory. |
10 |
| -# |
11 |
| -# ./miri build <flags>: |
12 |
| -# Just build miri. <flags> are passed to `cargo build`. |
13 |
| -# |
14 |
| -# ./miri test <flags>: |
15 |
| -# Build miri, set up a sysroot and then run the test suite. <flags> are passed |
16 |
| -# to the final `cargo test` invocation. |
17 |
| -# |
18 |
| -# ./miri run <flags>: |
19 |
| -# Build miri, set up a sysroot and then run the driver with the given <flags>. |
20 |
| -# |
21 |
| -# All commands also exist in a "-debug" variant (e.g. "./miri run-debug |
22 |
| -# <flags>") which uses debug builds instead of release builds, for faster build |
23 |
| -# times and slower execution times. |
24 |
| -# |
25 |
| -# ENVIRONMENT VARIABLES |
26 |
| -# |
27 |
| -# MIRI_SYSROOT: |
28 |
| -# If already set, the "sysroot setup" step is skipped. |
29 |
| -# |
30 |
| -# CARGO_EXTRA_FLAGS: |
31 |
| -# Pass extra flags to all cargo invocations. |
| 2 | +set -e |
| 3 | +USAGE=$(cat <<"EOF" |
| 4 | + COMMANDS |
| 5 | +
|
| 6 | +./miri install <flags>: |
| 7 | +Installs the miri driver and cargo-miri. <flags> are passed to `cargo |
| 8 | +install`. Sets up the rpath such that the installed binary should work in any |
| 9 | +working directory. |
| 10 | +
|
| 11 | +./miri build <flags>: |
| 12 | +Just build miri. <flags> are passed to `cargo build`. |
| 13 | +
|
| 14 | +./miri test <flags>: |
| 15 | +Build miri, set up a sysroot and then run the test suite. <flags> are passed |
| 16 | +to the final `cargo test` invocation. |
| 17 | +
|
| 18 | +./miri run <flags>: |
| 19 | +Build miri, set up a sysroot and then run the driver with the given <flags>. |
| 20 | +
|
| 21 | +All commands also exist in a "-debug" variant (e.g. "./miri run-debug |
| 22 | +<flags>") which uses debug builds instead of release builds, for faster build |
| 23 | +times and slower execution times. |
| 24 | +
|
| 25 | + ENVIRONMENT VARIABLES |
| 26 | +
|
| 27 | +MIRI_SYSROOT: |
| 28 | +If already set, the "sysroot setup" step is skipped. |
| 29 | +
|
| 30 | +CARGO_EXTRA_FLAGS: |
| 31 | +Pass extra flags to all cargo invocations. |
| 32 | +EOF |
| 33 | +) |
32 | 34 |
|
33 | 35 | ## Preparation
|
34 |
| -set -e |
35 | 36 | # I'd love to use `jq` for parsing the JSON properly, but macOS is totally underequipped for this kind of work.
|
36 | 37 | TARGET=$(rustc --print target-spec-json -Z unstable-options | grep llvm-target | cut -d '"' -f 4)
|
37 | 38 | SYSROOT=$(rustc --print sysroot)
|
@@ -135,4 +136,9 @@ run|run-debug)
|
135 | 136 | # Then run the actual command.
|
136 | 137 | exec cargo run $CARGO_BUILD_FLAGS "$@"
|
137 | 138 | ;;
|
| 139 | +*) |
| 140 | + echo "Unknown command: $COMMAND" |
| 141 | + echo |
| 142 | + echo "$USAGE" |
| 143 | + exit 1 |
138 | 144 | esac
|
0 commit comments