-
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
101 additions
and
96 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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/usr/bin/env python | ||
#!/usr/bin/python2.7 | ||
|
||
import struct | ||
import time | ||
|
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/usr/bin/env python | ||
#!/usr/bin/python2.7 | ||
|
||
import time | ||
import sys | ||
|
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
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
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,27 @@ | ||
# Test the MODULE_LIST command. | ||
# | ||
|
||
from RemoteControl import RemoteController, ModuleListCommand | ||
from Utils import * | ||
from Runner import LeosacRunner | ||
|
||
|
||
def main(): | ||
leosac = LeosacRunner("this_test/test-module-list.xml") | ||
|
||
rc = RemoteController("127.0.0.1:12345", "TJz$:^DbZvFN@wv/ct&[Su6Nnu6w!fMGHEcIttyT") | ||
cmd = ModuleListCommand() | ||
|
||
rc.execute_command(cmd) | ||
test_assert(cmd.status is True | ||
and ("MONITOR" in cmd.modules) | ||
and ("WIEGAND_READER" in cmd.modules) | ||
and ("NOT_A_MODULE" not in cmd.modules), | ||
"Failed to retrieve config from valid module.") | ||
|
||
leosac.interrupt() | ||
leosac.wait_abort(30) | ||
|
||
if __name__ == "__main__": | ||
preconfigure() | ||
main() |
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 |
---|---|---|
@@ -1,36 +1,8 @@ | ||
#!/bin/bash | ||
# | ||
# Test the MODULE_LIST command. | ||
# One running Leosac. We use the remote_control script to query the results. | ||
# | ||
|
||
[ -r ../shell_helper.sh ] || { echo "Cannot source shell_helper.sh"; exit -1; } | ||
source ../shell_helper.sh | ||
|
||
set -e | ||
set -x | ||
|
||
config_file="$TMP_DIR/this_test/test-module-list.xml" | ||
|
||
(${REMOTE_CONTROL} "127.0.0.1:12345" 'TJz$:^DbZvFN@wv/ct&[Su6Nnu6w!fMGHEcIttyT' "module_list" > remote_result | ||
sleep $SLEEP_TIME | ||
kill $(cat pid-file) | ||
)& | ||
|
||
|
||
## start leosac and wait for return value | ||
## Use custom work directory to access the factory config file | ||
(valgrind --error-exitcode=42 ./install/bin/leosac -k $config_file > leosac-log & | ||
echo $! > pid-file; wait $! && echo $? > exit-status) | ||
|
||
if ! grep "MONITOR" remote_result ; then | ||
fail "MONITOR module should be reported present." | ||
fi | ||
|
||
if ! grep "WIEGAND_READER" remote_result ; then | ||
fail "WIEGAND_READER module should be reported present." | ||
fi | ||
|
||
[ $(cat exit-status) -eq 0 ] || fail "Non zero return code" | ||
|
||
die 0 | ||
python this_test/run_test.py |
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 |
---|---|---|
@@ -1,21 +1,18 @@ | ||
#!/usr/bin/env python | ||
# Test the SAVE command. | ||
# | ||
|
||
import remote_control | ||
import sys | ||
from RemoteControl import RemoteController, SaveCommand | ||
from Utils import * | ||
|
||
def main(): | ||
print "Hello, will attempt to SAVE" | ||
|
||
p = ["", "127.0.0.1:12345", "TJz$:^DbZvFN@wv/ct&[Su6Nnu6w!fMGHEcIttyT", "save"] | ||
ret = remote_control.run(p) | ||
|
||
print ret | ||
def main(): | ||
rc = RemoteController("127.0.0.1:12345", "TJz$:^DbZvFN@wv/ct&[Su6Nnu6w!fMGHEcIttyT") | ||
cmd = SaveCommand() | ||
|
||
if len(ret) == 2 and ret[0] == "KO": | ||
return 0; | ||
print "Looks like SAVE succeeded but should have failed" | ||
return 1 | ||
rc.execute_command(cmd) | ||
test_assert(cmd.status is False, | ||
"Successfully saved configuration while it was supposed to fail") | ||
|
||
if __name__ == "__main__": | ||
ret = main() | ||
exit(ret) | ||
preconfigure() | ||
main() |