1 #!/usr/local/bin/python3.3
3 #note, this script should generally work with any version of Python above 2.5 (lot of used functions of the subprocess module are there since 2.6)
5 Quick and dirty script to automate benchmarking ryu board with RTEMS on board.
7 Should create the same directory structure as the shell scripts used when targeting linux,
8 but only uses two tests (one actually, the second one is reinterpretation of the data of the first one.)
10 Expects to be run from within the gw-tests directory and that the layout of boot files remains constant.
14 import sys, os, shutil, stat
15 from time import sleep
21 print("This script needs to be run as root.")
27 print("Starting the benchmark.")
28 hostname = lib.read_hostname()
29 print("Hostname is: ", hostname)
30 lib.set_hostname(hostname)
31 for test in tests.tests:
33 print("Current test is: ", testname)
34 lib.set_testname(testname)
35 for load in lib.load_types:
37 print("Current load is: ", load)
39 #Currently, because of problems with serial port, tests have associated images for behaviour
40 #otherwise, they are just histogram generators
42 #First part of load "handlers" -> start the proper load.
44 #we have to reflash cpu load image
45 #thus, this function actually waits for ~15s
46 print("Starting CPU load.")
47 lib.start_cpu_load(testname)
50 print("Starting eth load")
53 for traffic in lib.traffic_modes:
54 if traffic == "flood":
55 subprocess.call("ifconfig can0 txqueuelen 200".split()) #this stops latester from ending due to ENOBUFS errors
56 print("Can mode: ", traffic)
58 lib.set_traffic(traffic)
59 print("Testenv prepared")
64 #restart every can_mode change, just to be sure?
66 #give time to recover from load?
69 #Currently, because of problems with serial port, tests have associated images for behaviour
\r
70 #otherwise, they are just histogram generators
\r
72 #second part of the load "handlers" -> stopping the load
74 #we have to reflash "no cpu load" image
75 #thus, this function actually waits for ~15s
76 print("Stopping cpu load")
77 lib.stop_cpu_load(testname)
80 print("Stopping eth load")
86 print("Run should be now finished.")
92 if __name__ == "__main__":