def runMonitor(rvmonitor_bin, gen_monitor_dir, java_dir): """ Translates a .rvm file to Java. Args: rvmonitor_bin (str): The directory containing the rv-monitor tool. gen_monitor_dir (str): The directory containing the .rvm file. It must contain exactly one .rvm file and it must contain an .aj file associated with it. This directory is treated as a temporary directory (i.e. the Java files are generated here before being copied to the java_dir). java_dir (str): The directory in which to place the generated Java files. Raises: SubprocessError if the rv-monitor tool returned an error. Exception if the input directory contains no rvm file or more than one. """ tools.progress("Run RVMonitor") monitor_binary = os.path.join(rvmonitor_bin, "rv-monitor") rvm_file_paths = glob.glob(os.path.join(gen_monitor_dir, "*.rvm")) if len(rvm_file_paths) != 1: raise Exception("Expected a single rvm spec") rvm_file_path = rvm_file_paths[0] tools.runNoError([monitor_binary, "--controlAPI", "-merge", rvm_file_path]) for f in glob.glob(os.path.join(gen_monitor_dir, "*.java")): shutil.copy(f, java_dir)
def buildRvMonitor(): """ Builds and installs the RV-Monitor tool in the local Maven repository. Raises: SubprocessError if the mvn command returns an error code. """ tools.progress("Building RV-Monitor...") tools.runNoError(["mvn", "-B", "clean", "install", "-DskipTests"])
def initGitModules(): """ Runs "git submodule update --init --recursive". Raises: SubprocessError if the git command returns an error code. """ tools.progress("Updating the RV-Monitor submodules...") tools.runNoError(["git", "submodule", "update", "--init", "--recursive"])
def runMonitor(rvmonitor_bin, gen_monitor_dir, java_dir): tools.progress("Run RVMonitor") monitor_binary = os.path.join(rvmonitor_bin, "rv-monitor") rvm_file_paths = glob.glob(os.path.join(gen_monitor_dir, "*.rvm")) if len(rvm_file_paths) != 1: raise Exception("Expected a single rvm spec") rvm_file_path = rvm_file_paths[0] tools.runNoError([monitor_binary, "-merge", rvm_file_path]) for f in glob.glob(os.path.join(gen_monitor_dir, "*.java")): shutil.copy(f, java_dir)
def runTests(test_name): """ Uses Maven to run a Rvm unit-test. Args: test_name (str): The name of the test, used for user-friendly messages. Raises: SubprocessError if mvn returns an error code. """ tools.progress("Running the %s test(s)..." % test_name) tools.runNoError(["mvn", "-B", "clean", "test"]) tools.runNoError(["mvn", "-B", "clean"])
def runGetConsistency(): tools.progress("Running the getconsistency tests...") tools.runNoError(["mvn", "clean", "test", "-Dtest=db.GetConsistentTest"]) tools.runNoError( ["mvn", "clean", "test", "-Dtest=db.GetInconsistent1Test"]) tools.runNoError( ["mvn", "clean", "test", "-Dtest=db.GetInconsistent2Test"]) tools.runNoError(["mvn", "clean"])
def runPc(root_dir, arguments): """ Compiles p files. Args: root_dir (str): The root directory for the P compiler repository. arguments (str): The arguments for the P compiler arguments. Raises: SubprocessError if the P compiler returned an error code. """ tools.runNoError( ["dotnet", os.path.join(root_dir, "Bld", "Drops", "Release", "Binaries", "netcoreapp3.1", "P.dll")] + arguments )
def runTwoPhaseCommit(): tools.progress("Running the twophasecommit tests...") tools.runNoError( ["mvn", "clean", "test", "-Dtest=twophasecommit.PrepareSuccessTest"]) tools.runNoError( ["mvn", "clean", "test", "-Dtest=twophasecommit.PrepareFailureTest"]) tools.runNoError([ "mvn", "clean", "test", "-Dtest=twophasecommit.BuggyPrepareFailureTest" ]) tools.runNoError(["mvn", "clean"])
def createRvm(rvmonitor_bin, gen_monitor_setup_dir, java_dir): """ Compiles a rvm file to java. Args: rvmonitor_bin (str): Directory containing the rv-monitor binary. gen_monitor_setup_dir (str): Input directory containing a file called "unittest.rvm". The file will be changed during the call. java_dir: Destination directory for the generated Java files Raises: SubprocessError if the rv-monitor tool returned an error code. """ tools.progress("Run RVMonitor") monitor_binary = os.path.join(rvmonitor_bin, "rv-monitor") rvm_file = os.path.join(gen_monitor_setup_dir, "unittest.rvm") addRvmExceptions(rvm_file) tools.runNoError([monitor_binary, "-merge", "-d", java_dir, rvm_file])
def runPc(pcompiler_dir, arguments): tools.runNoError([ "dotnet", os.path.join(pcompiler_dir, "Bld", "Drops", "Release", "Binaries", "netcoreapp3.1", "P.dll") ] + arguments)
def runBtm(): tools.progress("Running the btm tests...") tools.runNoError(["mvn", "clean", "test", "-Dtest=TwoPCTest"]) tools.runNoError(["mvn", "clean", "test", "-Dtest=TwoPCPhase1FailureTest"]) tools.runNoError(["mvn", "clean"])
def runGetConsistency(): tools.progress("Running the getconsistency tests...") tools.runNoError(["mvn", "clean", "test", "-Dtest=TwoPCTest"]) tools.runNoError(["mvn", "clean", "test", "-Dtest=TwoPCPhase1FailureTest"]) tools.runNoError(["mvn", "clean"])
def runTwoPhaseCommit(): tools.progress("Running the twophasecommit tests...") tools.runNoError( ["mvn", "clean", "test", "-Dtest=twophasecommit.TwoPhaseCommitTest"]) tools.runNoError(["mvn", "clean"])