tests: Fix tests that were defect

* I used pexpect instead of when expect script was not working expect, since
  TCL confuses me
* I deleted the thread_exit test since it was completely invalid
This commit is contained in:
Martine Lenders 2014-08-08 20:59:45 +02:00
parent ee620b1bf7
commit 2bbe92a75a
4 changed files with 35 additions and 68 deletions

View File

@ -1,47 +0,0 @@
#!/usr/bin/expect
set timeout 5
spawn pseudoterm $env(PORT)
expect {
"OK" {}
timeout { exit 1 }
}
expect {
"set callback 1" {}
timeout { exit 1 }
}
expect {
"set callback 2" {}
timeout { exit 1 }
}
expect {
"set callback 3" {}
timeout { exit 1 }
}
expect {
"callback 1" {}
timeout { exit 1 }
}
expect {
"callback 3" {}
timeout { exit 1 }
}
expect {
"callback 2" {}
timeout { exit 1 }
}
expect {
"hwtimer set." {}
timeout { exit 1 }
}
puts "\nTest successful!\n"

View File

@ -0,0 +1,32 @@
#!/usr/bin/env python
from pexpect import spawn, TIMEOUT
DEFAULT_TIMEOUT=5
hwtimers = 0
term = spawn("make term")
term.expect(r"Setting timers:", timeout=DEFAULT_TIMEOUT)
try:
while True:
term.expect(r"set callback\s+\d+", timeout=DEFAULT_TIMEOUT)
hwtimers += 1
except TIMEOUT:
pass
term.expect(r"All timers set.", timeout=DEFAULT_TIMEOUT)
term.expect(r"callback\s+1", timeout=DEFAULT_TIMEOUT)
print("Got callback 1")
while hwtimers > 1:
term.expect(r"callback\s+{:d}".format(hwtimers), timeout=DEFAULT_TIMEOUT)
print("Got callback {:d}".format(hwtimers))
hwtimers -= 1
# Setting timers:
# term.expect("OK")
if not term.terminate():
term.terminate(force=True)

View File

@ -1,14 +1,8 @@
#!/usr/bin/python
import pexpect
import os
import subprocess
child = pexpect.spawn("board/msba2/tools/bin/pseudoterm %s" % os.environ["PORT"])
term = pexpect.spawn("make term")
null = open('/dev/null', 'wb')
subprocess.call(['jam', 'reset'], stdout=null)
child.expect ('first thread\r\n')
child.expect ('second thread\r\n')
print("Test successful!")
term.expect('first thread\r\n')
term.expect('second thread\r\n')

View File

@ -1,12 +0,0 @@
#!/usr/bin/expect
set timeout 5
spawn board/msba2/tools/bin/pseudoterm $env(PORT)
expect {
"Hello World!" {}
timeout { exit 1 }
}
puts "\nTest successful!\n"