forked from newaetech/chipwhisperer
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Starting to add test scripts for releases
- Loading branch information
1 parent
49c36a1
commit 1879949
Showing
2 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from TestVictimFirmware import TestVictimFirmware as tvf | ||
|
||
def testEverything(): | ||
tvf().test() | ||
|
||
|
||
if __name__ == '__main__': | ||
testEverything() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# | ||
#ChipWhisperer Release Test Script | ||
# | ||
|
||
import subprocess, os | ||
|
||
def testRV(rv): | ||
if rv[0]: | ||
print "[OK]" | ||
else: | ||
print "[FAILED]" | ||
print "stdout: %s"%rv[1][0] | ||
print "stderr: %s"%rv[1][1] | ||
raise ValueError("Test Failed") | ||
|
||
class TestVictimFirmware(object): | ||
|
||
def __init__(self): | ||
self.env = os.environ.copy() | ||
|
||
# For Windows | ||
self.env["PATH"] = self.env["PATH"] + r";C:\WinAVR-20100110\bin;C:\WinAVR-20100110\utils\bin" | ||
|
||
self.basePath = "../../hardware/victims/firmware/" | ||
|
||
def test(self): | ||
print "--Victim Firmware Build Test--" | ||
tests = 5 | ||
|
||
print " avr-serial-nocrypto ", | ||
testRV(self.runMake('avr-serial-nocrypto', 'MCU=atmega328p')) | ||
|
||
print " avr-serial with crypto ", | ||
testRV(self.runMake('avr-serial', 'MCU=atmega328p')) | ||
|
||
print " xmega-serial with crypto ", | ||
#todo: fix this script so don't need this bogus argument | ||
testRV(self.runMake('xmega-serial', 'IGNORETHIS=22')) | ||
|
||
def runMake(self, path, args): | ||
self.runMakeLL(path, [args, "clean"]) | ||
rv = self.runMakeLL(path, args) | ||
self.runMakeLL(path, [args, "clean"]) | ||
return rv | ||
|
||
def runMakeLL(self, path, args): | ||
path = os.path.join(self.basePath, r'%s' % path) | ||
# print path | ||
vl = subprocess.Popen(["make", args], env=self.env, cwd=path, shell=True) | ||
data = vl.communicate() | ||
|
||
if (vl.returncode == 0): | ||
return (True, data) | ||
|
||
return (False, data) | ||
|
||
|
||
if __name__ == '__main__': | ||
tvf = TestVictimFirmware() | ||
tvf.test() |