Runnable jcstress + JUnit companion for the ankurm.com post on the Java Memory Model, double-checked locking, and the volatile fix.
16 lines
568 B
Bash
Executable File
16 lines
568 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Quick ad hoc jcstress run against one test class, printed to the terminal instead of
|
|
# a captured output/ file. Example:
|
|
# ./scripts/run.sh PlainPublicationTest
|
|
# ./scripts/run.sh PlainPublicationTest -m tough # extra args pass straight through
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")/.."
|
|
|
|
TEST="${1:?Usage: run.sh <TestClassName> [extra jcstress args]}"
|
|
shift || true
|
|
|
|
JAR=target/jcstress.jar
|
|
[ -f "$JAR" ] || { echo "Run 'mvn package' first."; exit 1; }
|
|
|
|
java -jar "$JAR" -t "$TEST" -jvmArgs "-Xmx256m" -f 2 -iters 15 -time 1000 -v "$@"
|