summaryrefslogtreecommitdiffstats
path: root/test_driver
diff options
context:
space:
mode:
authorMac Mollison <mollison@cs.unc.edu>2010-02-08 00:24:40 -0500
committerMac Mollison <mollison@cs.unc.edu>2010-02-08 00:27:11 -0500
commit1016a3e271faebb899766f5d18468dd88b4d84b7 (patch)
tree387ab36e8ee886d8d6741d5820c178c974f46252 /test_driver
parentcd6e43f37856f7fe6b60e0e2ae45f864a4bd6d64 (diff)
This is the beginning of a very major refactoring of the tool.
Current features: - Create a record stream from trace files - Print the record stream to standard out - TODO file - README file - run.py file to set up and execute the testing pipeline
Diffstat (limited to 'test_driver')
-rw-r--r--test_driver/make_devices18
-rw-r--r--test_driver/sample_test_case.py9
-rwxr-xr-xtest_driver/test.py147
3 files changed, 0 insertions, 174 deletions
diff --git a/test_driver/make_devices b/test_driver/make_devices
deleted file mode 100644
index 4d4554b..0000000
--- a/test_driver/make_devices
+++ /dev/null
@@ -1,18 +0,0 @@
1#!/bin/bash
2
3#Creates device drivers for traces (litmus_log, ft_trace and sched_trace)
4#Taken from http://www.cs.unc.edu/~anderson/litmus-rt/doc/tracing.html
5
6LITMUS_LOG_MAJOR=`grep litmus_log /proc/devices | awk '{print $1}'`
7FT_TRACE_MAJOR=`grep ft_trace /proc/devices | awk '{print $1}'`
8SCHED_TRACE_MAJOR=`grep sched_trace /proc/devices | awk '{print $1}'`
9
10mknod litmus_log c $LITMUS_LOG_MAJOR 0
11mknod ft_trace c $FT_TRACE_MAJOR 0
12
13NUM_PROCS=$((`grep 'processor' /proc/cpuinfo | wc -l` - 1))
14
15for P in `seq 0 $NUM_PROCS`
16do
17 mknod "sched_trace$P" c $SCHED_TRACE_MAJOR $P
18done
diff --git a/test_driver/sample_test_case.py b/test_driver/sample_test_case.py
deleted file mode 100644
index 6cb886e..0000000
--- a/test_driver/sample_test_case.py
+++ /dev/null
@@ -1,9 +0,0 @@
1#Sample test case for the test driver.
2
3#Each element of the test_case list is a real-time executable task, with parameters.
4#For each task, we have a list: [location of executable,wcet,period,duration].
5
6test_case = [
7 ['/root/liblitmus/rtspin',10,100,1000]
8 ['/root/liblitmus/rtspin',10,100,1000]
9]
diff --git a/test_driver/test.py b/test_driver/test.py
deleted file mode 100755
index 87038a0..0000000
--- a/test_driver/test.py
+++ /dev/null
@@ -1,147 +0,0 @@
1#!/usr/bin/env python3
2
3##########
4#Settings#
5##########
6
7#liblitmus directory (You need to put the compiled liblitmus here)
8liblitmus_dir = '/root/liblitmus/'
9
10#ft_tools directory (You need to but the compiled ft_tools here)
11ft_tools_dir = '/root/ft_tools/'
12
13#device files directory (This script will set up the device files here)
14device_dir = '/root/device_files/'
15
16#recorded trace directory (This script will place recorded traces here)
17trace_dir = '/root/traces/'
18
19#desired scheduling policy, to be set by this script
20#options listed in /proc/litmus/plugins
21policy = 'GSN-EDF'
22
23#desired test case
24test_case_file = 'sample_test_case'
25
26#name of traces
27trace_name = 'driver'
28
29#Additional instructions:
30# -Make sure you've chmod +x'd the make_devices file and kept it in the same
31# dir as test.py
32# -Make sure you've set up a test case
33
34###########
35# Imports #
36###########
37
38import subprocess
39import os
40import time
41exec('from ' + test_case_file + ' import test_case')
42
43#################
44# Run the tests #
45#################
46
47def main():
48
49 #Determine directory of test.py
50 test_dir = os.getcwd()
51
52 #Set scheduling policy
53 print("Setting scheduling policy... ",end='')
54 ret = subprocess.getstatusoutput(
55 'echo ' + policy + ' > ' + '/proc/litmus/active_plugin')
56 if ret[0] == 0:
57 print("[SUCCESS]")
58 else:
59 print("[FAILURE], error was:")
60 print(str(ret[0]) + ': ' + ret[1])
61 exit()
62
63 #Check for execute permission on the make_devices script
64 print("Checking for permission to run make_devices... ",end='')
65 if not os.access('./make_devices',os.X_OK):
66 print("\nAttempting to chmod +x make_devices... ",end='')
67 ret = subprocess.getstatusoutput('chmod +x ./make_devices')
68 if ret[0]!=1:
69 print("[FAILURE], error was:")
70 print(str(ret[0]) + ': ' + ret[1])
71 exit()
72 print("[SUCCESS]")
73
74 #Setup the device files for the traces
75 print("Creating device files. OK if they already exist.")
76 subprocess.Popen(test_dir + '/make_devices',cwd=device_dir)
77 time.sleep(1)
78
79 #Set up environment variables needed for st_trace script
80 print("Setting up environment variables... ",end='')
81 os.putenv('FTCAT', ft_tools_dir + 'ftcat')
82 os.putenv('FTDEV',device_dir + 'sched_trace')
83 print("[SUCCESS]")
84
85 #See if we can access and run st_trace
86 print("Checking for permission to run st_trace... ",end='')
87 if not os.access(ft_tools_dir + 'st_trace',os.X_OK):
88 print("\nAttempting to chmod +x st_trace... ",end='')
89 ret = subprocess.getstatusoutput('chmod +x ' +
90 ft_tools_dir + 'st_trace')
91 if ret[0]!=1:
92 print("[FAILURE], error was:")
93 print(str(ret[0]) + ': ' + ret[1])
94 exit()
95 print("[SUCCESS]")
96
97 #Start sched_trace
98 print("Starting st_trace trace recorder... ",end='')
99 st_trace = subprocess.Popen([ft_tools_dir + 'st_trace',trace_name],
100 cwd=trace_dir)
101 print("[SUCCESS]")
102
103 #We will get an error there, if the test.py program terminates.
104 #time.sleep(7)
105
106 #Start tasks in test_case
107 print("Launching tasks... ",end='')
108 for task in test_case:
109 subprocess.Popen([task[0],'-w',str(task[1]),str(task[2]),str(task[3])])
110 print("[SUCCESS]")
111
112 #Wait for tasks to suspend themselves
113 print("Waiting for tasks to suspend... ",end='')
114 time.sleep(3)
115 print("[SUCCESS]")
116
117 #Release the tasks
118 print("Releasing the tasks... ",end='')
119 ret = subprocess.getstatusoutput(liblitmus_dir + 'release_ts')
120 if ret[0] != 0:
121 print("[FAILURE], error was:")
122 print(str(ret[0]) + ': ' + ret[1])
123 exit()
124 print("[SUCCESS]")
125
126 #Wait for the tasks to complete. I still need to implement this.
127
128
129 #Current steps...
130 #Run st_trace (must tell it location of sched_trace device files exactly)
131 #Let it get set up, then suspend
132 #let it run in background with bg <job>
133 #Run rtspin 10 100 1000 twice; suspend, run in background
134 #Bring rtspins to foreground and stop them.
135 #Bring st_trace to foreground, hit enter to complete it.
136
137 #Need to try to do the above with rt_launch and then release_ts
138
139
140
141##############
142# start main #
143##############
144
145if __name__=='__main__':
146 main()
147