#!/bin/bash

# Assumes $REPO_DIR is an OpenJDK repo (commit 5a45c25151b1da) containing a linux-x86_64-server-release build. Assumes the dir also contains replay_pid2002869.log.

REPO_DIR=/home/rocastan/git/views/JDK-8297345/open
JTREG_DIR=/home/rocastan/tools/jtreg
BUILD_DIR=$REPO_DIR/build/linux-x86_64-server-release
CLASSPATH=$REPO_DIR:$JTREG_DIR/lib/javatest.jar:$JTREG_DIR/lib/jtreg.jar:$JTREG_DIR/lib/junit-platform-console-standalone-1.8.2.jar:$JTREG_DIR/lib/testng-7.3.0.jar:$JTREG_DIR/lib/jcommander-1.78.jar:$JTREG_DIR/lib/guice-4.2.3.jar

make run-test TEST="java/util/concurrent/ConcurrentQueues/OfferRemoveLoops.java"

for SRC in './test/lib/jdk/test/lib/*.java ./test/lib/jdk/test/lib/process/*.java' ./test/lib/jdk/test/lib/Asserts.java ./test/lib/jdk/test/lib/Platform.java ./test/lib/jdk/test/lib/Utils.java ./test/jdk/java/util/concurrent/ConcurrentQueues/OfferRemoveLoops.java ./test/jdk/java/util/AbstractCollection/ToArrayTest.java ./test/jdk/java/util/concurrent/ConcurrentQueues/IteratorWeakConsistency.java ./test/jdk/java/util/Collections/EmptyCollectionSerialization.java ./test/jdk/java/util/concurrent/ConcurrentQueues/GCRetention.java ./test/jdk/java/util/AbstractMap/SimpleEntries.java ./test/jdk/java/util/Collections/Frequency.java test/jdk/java/util/ArrayList/Bug6533203.java ./test/jdk/java/util/Collections/RacingCollections.java
do
    $BUILD_DIR/jdk/bin/javac -d . -cp $CLASSPATH $SRC
done

$BUILD_DIR/jdk/bin/java -cp $CLASSPATH -XX:+UnlockDiagnosticVMOptions -XX:+ReplayCompiles -XX:+ReplayIgnoreInitErrors -XX:ReplayDataFile=replay_pid2002869.log -XX:+PrintCompilation
