added support files
This commit is contained in:
parent
5067f03322
commit
13f0d05de5
Binary file not shown.
|
@ -0,0 +1,39 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- WARNING: Eclipse auto-generated file.
|
||||
Any modifications will be overwritten.
|
||||
To include a user specific buildfile here, simply create one in the same
|
||||
directory with the processing instruction <?eclipse.ant.import?>
|
||||
as the first entry and export the buildfile again. --><project basedir="." default="build">
|
||||
<property environment="env"/>
|
||||
<property name="debuglevel" value="source,lines,vars"/>
|
||||
<property name="target" value="1.8"/>
|
||||
<property name="source" value="1.8"/>
|
||||
<target name="init">
|
||||
<mkdir dir="bin"/>
|
||||
<copy includeemptydirs="false" todir="bin">
|
||||
<fileset dir="src">
|
||||
<exclude name="**/*.launch"/>
|
||||
<exclude name="**/*.java"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
</target>
|
||||
<target name="clean">
|
||||
<delete dir="bin"/>
|
||||
</target>
|
||||
<target depends="clean" name="cleanall"/>
|
||||
<target depends="build-subprojects,build-project" name="build"/>
|
||||
<target name="build-subprojects"/>
|
||||
<target depends="init" name="build-project">
|
||||
<javac debug="true" debuglevel="${debuglevel}" destdir="bin" includeantruntime="false" source="${source}" target="${target}">
|
||||
<src path="src"/>
|
||||
</javac>
|
||||
</target>
|
||||
<target name="make-jar" depends="build">
|
||||
<mkdir dir="jars"/>
|
||||
<jar destfile="jars/simulator.jar" basedir="bin">
|
||||
<manifest>
|
||||
<attribute name="Main-Class" value="main.Main"/>
|
||||
</manifest>
|
||||
</jar>
|
||||
</target>
|
||||
</project>
|
|
@ -0,0 +1,40 @@
|
|||
.data
|
||||
a:
|
||||
40
|
||||
20
|
||||
50
|
||||
60
|
||||
80
|
||||
30
|
||||
10
|
||||
70
|
||||
n:
|
||||
8
|
||||
.text
|
||||
main:
|
||||
sub %x3, %x3, %x3
|
||||
sub %x4, %x4, %x4
|
||||
load %x0, $n, %x8
|
||||
outerloop:
|
||||
blt %x3, %x8, innerloop
|
||||
end
|
||||
addi %x3, 1, %x4
|
||||
innerloop:
|
||||
addi %x3, 1, %x4
|
||||
innerloopz:
|
||||
blt %x4, %x8, swap
|
||||
addi %3, 1, %x3
|
||||
jmp outerloop
|
||||
swap:
|
||||
load %x3, $a, %x5
|
||||
load %x4, $a, %x6
|
||||
blt %x5, %x6, exchange
|
||||
addi %x4, 1, %x4
|
||||
jmp innerloopz
|
||||
exchange:
|
||||
sub %x7, %x7, %x7
|
||||
add %x0, %x5, %x7
|
||||
store %x6, 0, %x3
|
||||
store %x7, 0, %x4
|
||||
addi %x4, 1, %x4
|
||||
jmp innerloopz
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1 @@
|
|||
Hash of the Processor State = 255541867
|
Binary file not shown.
|
@ -0,0 +1,15 @@
|
|||
.data
|
||||
n:
|
||||
11
|
||||
.text
|
||||
main:
|
||||
load %x0, $n, %x3
|
||||
divi %x3, 2, %x3
|
||||
beq %x0, %x31, even
|
||||
sub %x10, %x10, %x10
|
||||
addi %x10, 1, %x10
|
||||
end
|
||||
even:
|
||||
sub %x10, $x10, %x10
|
||||
subi %x10, 1, %x10
|
||||
end
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1 @@
|
|||
Hash of the Processor State = -224294686
|
Binary file not shown.
|
@ -0,0 +1,28 @@
|
|||
.data
|
||||
n:
|
||||
10
|
||||
.text
|
||||
main:
|
||||
addi %x0, 0, %x3
|
||||
addi %x0, 1, %x4
|
||||
add %x3, %x4, %x5
|
||||
load %x0, $n, %x6
|
||||
addi %x0, 65535, %x7
|
||||
addi %x0, 0, %x8
|
||||
store %x3, 0, %x7
|
||||
subi %x7, 1, %x7
|
||||
addi %x8, 1, %x8
|
||||
store %x4, 0, %x7
|
||||
subi %x7, 1, %x7
|
||||
addi %x8, 1, %x8
|
||||
for:
|
||||
blt %x8, %x6, loop
|
||||
end
|
||||
loop:
|
||||
add %x3, %x4, %x5
|
||||
store %x5, 0, %x7
|
||||
subi %x7, 1, %x7
|
||||
addi %x8, 1, %x8
|
||||
add %x0, %x4, %x3
|
||||
add %x0, %x5, %x4
|
||||
jmp for
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1 @@
|
|||
Hash of the Processor State = -1518357572
|
Binary file not shown.
|
@ -0,0 +1,23 @@
|
|||
.data
|
||||
a:
|
||||
4567654
|
||||
.text
|
||||
main:
|
||||
load %x0, $a, %x3
|
||||
sub %x7, %x7, %x7
|
||||
loop:
|
||||
divi %x3, 10, %x4
|
||||
addi %x31, 0, %x30
|
||||
muli %x7, 10, %x7
|
||||
add %x7, %x30, %x7
|
||||
divi %x3, 10, %x3
|
||||
bgt %x3, %x0, loop
|
||||
load %x0, $a, %x5
|
||||
beq %x5, %x7, palindrome
|
||||
sub %x10, %x10, %x10
|
||||
subi %x10, 1, %x10
|
||||
end
|
||||
palindrome:
|
||||
sub %x10, %x10, %x10
|
||||
addi %x10, 1, %x10
|
||||
end
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,2 @@
|
|||
Hash of the Processor State = 155317940
|
||||
|
Binary file not shown.
|
@ -0,0 +1,24 @@
|
|||
.data
|
||||
a:
|
||||
11
|
||||
.text
|
||||
main:
|
||||
load %x0, $a, %x3
|
||||
sub %x4, %x4, %x4
|
||||
divi %x3, 2, %x4
|
||||
sub %x6, %x6, %x6
|
||||
addi %x6, 2, %x6
|
||||
for:
|
||||
bgt %x6, %x4, prime
|
||||
div %x3, %x6, %x7
|
||||
beq %x0, %x31, notprime
|
||||
addi %x6, 1, %x6
|
||||
jmp for
|
||||
prime:
|
||||
sub %x10, %x10, %x10
|
||||
addi %x10, 1, %x10
|
||||
end
|
||||
notprime:
|
||||
sub %x10, %x10, %x10
|
||||
subi %x10, 1, %x10
|
||||
end
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1 @@
|
|||
Hash of the Processor State = -1414219998
|
Binary file not shown.
|
@ -0,0 +1,92 @@
|
|||
#!/bin/python
|
||||
|
||||
import sys
|
||||
import os
|
||||
import zipfile
|
||||
import shutil
|
||||
import subprocess
|
||||
from threading import Timer
|
||||
|
||||
zip_file = sys.argv[1]
|
||||
|
||||
l = len(zip_file.split("/"))
|
||||
print "Students :"
|
||||
for i in range(0, len(zip_file.split("/")[l-1].split("_"))):
|
||||
print zip_file.split("/")[l-1].split("_")[i].split(".")[0]
|
||||
print ""
|
||||
|
||||
submissions_temp_dir = "./submissions/"
|
||||
|
||||
if not os.path.exists(submissions_temp_dir):
|
||||
os.mkdir(submissions_temp_dir)
|
||||
|
||||
zip_ref = zipfile.ZipFile(zip_file, 'r')
|
||||
zip_ref.extractall(submissions_temp_dir)
|
||||
zip_ref.close()
|
||||
|
||||
shutil.copyfile("build.xml", submissions_temp_dir + "/build.xml")
|
||||
|
||||
os.chdir(submissions_temp_dir)
|
||||
|
||||
stdout_file = open("./tmp.output", 'a')
|
||||
popen_args = ["ant", "make-jar"]
|
||||
proc = subprocess.Popen(popen_args, stdout = stdout_file, stderr = stdout_file)
|
||||
timer = Timer(5, proc.kill)
|
||||
try:
|
||||
timer.start()
|
||||
stdout, stderr = proc.communicate()
|
||||
finally:
|
||||
timer.cancel()
|
||||
stdout_file.close()
|
||||
|
||||
if not os.path.exists("jars/simulator.jar"):
|
||||
print "compilation failed. jar file not created"
|
||||
sys.exit(0)
|
||||
|
||||
test_cases_dir = "../test_cases"
|
||||
total_marks = 0
|
||||
scored_marks = 0
|
||||
for testcase in os.listdir(test_cases_dir):
|
||||
if ".out" in testcase:
|
||||
total_marks = total_marks + 1
|
||||
|
||||
stdout_file = open("./" + testcase.split(".")[0] + ".observedoutput", 'w')
|
||||
popen_args = ["java", "-Xmx1g", "-jar", "jars/simulator.jar", "./src/configuration/config.xml", "./" + testcase.split(".")[0] + ".observedstat", test_cases_dir + "/" + testcase]
|
||||
# print popen_args
|
||||
proc = subprocess.Popen(popen_args, stdout = stdout_file, stderr = stdout_file)
|
||||
timer = Timer(5, proc.kill)
|
||||
try:
|
||||
timer.start()
|
||||
stdout, stderr = proc.communicate()
|
||||
finally:
|
||||
timer.cancel()
|
||||
stdout_file.close()
|
||||
|
||||
if os.path.exists("./" + testcase.split(".")[0] + ".observedoutput"):
|
||||
expectedoutput_file = open(test_cases_dir + "/" + testcase.split(".")[0] + ".expected")
|
||||
expected_hash = expectedoutput_file.readline()
|
||||
expectedoutput_file.close()
|
||||
|
||||
correct = False
|
||||
observedoutput_file = open("./" + testcase.split(".")[0] + ".observedoutput")
|
||||
for line in observedoutput_file:
|
||||
# if "Hash" in line:
|
||||
# print "computed = " + line
|
||||
# print "expected = " + expected_hash
|
||||
if line == expected_hash:
|
||||
correct = True
|
||||
break
|
||||
observedoutput_file.close()
|
||||
if correct == True:
|
||||
scored_marks = scored_marks + 1
|
||||
print testcase + " : PASS!"
|
||||
else:
|
||||
print testcase + " : fail - incorrect hash"
|
||||
else:
|
||||
print testcase + " : fail - standard output file not created"
|
||||
|
||||
os.chdir("..")
|
||||
|
||||
shutil.rmtree(submissions_temp_dir)
|
||||
|
||||
print "\ntotal score = " + str(scored_marks) + " out of " + str(total_marks)
|
Loading…
Reference in New Issue