Skip to content

Commit

Permalink
Added scripts to run the philosophers tests and colect the results
Browse files Browse the repository at this point in the history
  • Loading branch information
michbarsinai committed Aug 17, 2017
1 parent d79dcd3 commit 5cb762a
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
/docs/build/
/nbproject/
settings.xml

tst/results/*
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@ public static void dfsUsingStack(Node node) throws BadTraceException, Exception

visitesNodes.add(node.hashCode());
pathNodes.add(node);


long iterationCount = 0;
while (!pathNodes.isEmpty()) {

iterationCount++;
node = pathNodes.peek();

// This flag remains false if node doesn't have an unvisited
Expand All @@ -81,12 +82,12 @@ public static void dfsUsingStack(Node node) throws BadTraceException, Exception

break;
}
if ( visitedStatesCount%10000==0 ) {
System.out.printf("~ %,d states scanned\n", visitedStatesCount);
}

}

if ( iterationCount%1000==0 ) {
System.out.printf("~ %,d states scanned (iteration %,d)\n", visitedStatesCount, iterationCount);
}
if (!flag || pathNodes.size() >= MAX_PATH) {
pathNodes.pop();
}
Expand Down
Binary file added tst/BPjs-0.8.6-SNAPSHOT-tests.jar
Binary file not shown.
Binary file added tst/BPjs-0.8.6-SNAPSHOT.jar
Binary file not shown.
Binary file added tst/rhino-1.7.7.1.jar
Binary file not shown.
26 changes: 26 additions & 0 deletions tst/run-all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

# Runs all tests from 4 to $MAX.

if (($# < 2)); then
echo Usage: $0 MIN MAX
echo where MIN and MAX are the start and end number of philosophers \(inclusive\).
exit 1
fi

MIN=$1
MAX=$2

DATE_STR=`date "+%d%m%y-%H%M"`
RESULT_FOLDER=results/$DATE_STR
mkdir -p $RESULT_FOLDER


for i in `seq $MIN $MAX`
do
echo Running with $i philosophers
date "+%H:%M:%S"
./run-test.sh $i > $RESULT_FOLDER/$i-out.log 2>&1
date "+%H:%M:%S"
echo DONE
done
6 changes: 6 additions & 0 deletions tst/run-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

echo Single test case with $1 philosophers.

java -Xmx8g -cp BPjs-0.8.6-SNAPSHOT.jar:BPjs-0.8.6-SNAPSHOT-tests.jar:rhino-1.7.7.1.jar\
il.ac.bgu.cs.bp.bpjs.diningphil.DiningPhilMain $1 $1

0 comments on commit 5cb762a

Please sign in to comment.