aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorBjoern B. Brandenburg <bbb@cs.unc.edu>2009-09-11 06:04:13 -0400
committerBjoern B. Brandenburg <bbb@cs.unc.edu>2009-09-11 06:04:13 -0400
commit8680f73bd0377d87925a2f7854c75a4a8b09cff7 (patch)
treeef096bec2bb86a043b41cdf7b843f2fa51440d3d /bin
parent945c316dec15045accfc87336b3dc8d1ca0b5109 (diff)
Remove old tests.
People got confused how to use them. They were never meant to be useful to outside developers. So, just get rid of them now.
Diffstat (limited to 'bin')
-rw-r--r--bin/mode_test.c116
-rw-r--r--bin/np_test.c56
-rw-r--r--bin/wait_test.c103
3 files changed, 0 insertions, 275 deletions
diff --git a/bin/mode_test.c b/bin/mode_test.c
deleted file mode 100644
index 8bdf21b..0000000
--- a/bin/mode_test.c
+++ /dev/null
@@ -1,116 +0,0 @@
1#include <stdio.h>
2#include <stdlib.h>
3#include <signal.h>
4#include <unistd.h>
5#include <sys/time.h>
6#include <sys/wait.h>
7#include <sys/types.h>
8#include <sys/stat.h>
9#include <fcntl.h>
10
11#include "litmus.h"
12
13#define US_PER_MS 1000
14
15int prefix(void)
16{
17 char field[1024];
18 int prefix[1024];
19 int i, sum = 0;
20
21 for (i = 0; i < 1024; i++) {
22 sum += field[i];
23 prefix[i] = sum;
24 }
25 return sum;
26}
27
28void do_stuff(void)
29{
30 int i =0, j =0;
31
32 for (; i < 50000; i++)
33 j += prefix();
34}
35
36#define CALL(sc) do { ret = sc; if (ret == -1) {perror(" (!!) " #sc " failed"); /*exit(1)*/;}} while (0);
37
38unsigned int job_no;
39
40void next(void)
41{
42 int ret;
43 unsigned int actual;
44 CALL(get_job_no(&actual));
45 CALL(wait_for_job_release(++job_no));
46 printf("Now executing job %u, waited for %u\n", actual, job_no);
47}
48
49int main(int argc, char** argv)
50{
51 int ret;
52
53 init_litmus();
54
55 CALL(getpid());
56 printf("my pid is %d\n", ret);
57
58
59 CALL(get_job_no(&job_no));
60 printf("my job_no is %u", job_no);
61
62 CALL( task_mode(LITMUS_RT_TASK) );
63
64 CALL( sporadic_global(3, 33) );
65
66 CALL( task_mode(LITMUS_RT_TASK) );
67
68 next();
69 do_stuff();
70
71 next();
72 do_stuff();
73
74 next();
75 do_stuff();
76
77 CALL( task_mode(BACKGROUND_TASK) );
78
79 do_stuff();
80 do_stuff();
81 do_stuff();
82 do_stuff();
83 do_stuff();
84
85 CALL( task_mode(LITMUS_RT_TASK) );
86
87 do_stuff();
88 do_stuff();
89 do_stuff();
90 do_stuff();
91 do_stuff();
92
93
94 next();
95 next();
96 next();
97 next();
98 next();
99 next();
100 next();
101
102
103 next();
104 do_stuff();
105
106 next();
107 do_stuff();
108
109 next();
110 do_stuff();
111
112 CALL( task_mode(BACKGROUND_TASK) );
113 printf("Exiting...\n");
114
115 return 0;
116}
diff --git a/bin/np_test.c b/bin/np_test.c
deleted file mode 100644
index dad68aa..0000000
--- a/bin/np_test.c
+++ /dev/null
@@ -1,56 +0,0 @@
1#include <stdio.h>
2#include <stdlib.h>
3#include <signal.h>
4#include <unistd.h>
5#include <sys/time.h>
6#include <sys/wait.h>
7#include <sys/types.h>
8#include <sys/stat.h>
9#include <fcntl.h>
10
11#include "litmus.h"
12
13#define US_PER_MS 1000
14
15#define NUMTASKS 4
16
17int prefix(void)
18{
19 char field[1024];
20 int prefix[1024];
21 int i, sum = 0;
22
23 for (i = 0; i < 1024; i++) {
24 sum += field[i];
25 prefix[i] = sum;
26 }
27 return sum;
28}
29
30
31void do_stuff(void)
32{
33 int i =0, j =0;
34
35 for (; i < 50000; i++)
36 j += prefix();
37}
38
39#define CALL(sc) do { ret = sc; if (ret == -1) {perror(" (!!) " #sc " failed: "); /*exit(1)*/;}} while (0);
40
41
42int main(int argc, char** argv)
43{
44 int ret;
45
46 init_litmus();
47
48 enter_np();
49
50 do_stuff();
51
52 exit_np();
53
54
55 return 0;
56}
diff --git a/bin/wait_test.c b/bin/wait_test.c
deleted file mode 100644
index efd4d90..0000000
--- a/bin/wait_test.c
+++ /dev/null
@@ -1,103 +0,0 @@
1#include <stdio.h>
2#include <stdlib.h>
3#include <signal.h>
4#include <unistd.h>
5#include <sys/time.h>
6#include <sys/wait.h>
7#include <sys/types.h>
8#include <sys/stat.h>
9#include <fcntl.h>
10
11#include "litmus.h"
12
13#define US_PER_MS 1000
14
15#define NUMTASKS 4
16
17int prefix(void)
18{
19 char field[1024];
20 int prefix[1024];
21 int i, sum = 0;
22
23 for (i = 0; i < 1024; i++) {
24 sum += field[i];
25 prefix[i] = sum;
26 }
27 return sum;
28}
29
30
31void do_stuff(void)
32{
33 int i =0, j =0;
34
35 for (; i < 50000; i++)
36 j += prefix();
37}
38
39#define CALL(sc) do { ret = sc; if (ret == -1) {perror(" (!!) " #sc " failed: "); /*exit(1)*/;}} while (0);
40
41unsigned int job_no;
42
43
44void next(void)
45{
46 int ret;
47 unsigned int actual;
48 CALL(get_job_no(&actual));
49 CALL(wait_for_job_release(++job_no));
50 printf("Now executing job %u, waited for %u\n", actual, job_no);
51}
52
53void sync_jobs(void)
54{
55 int ret;
56 unsigned int actual;
57 CALL(get_job_no(&actual));
58 job_no = actual;
59}
60
61
62int main(int argc, char** argv)
63{
64 int ret;
65
66 init_litmus();
67
68 CALL(getpid());
69 printf("my pid is %d\n", ret);
70
71
72 CALL(get_job_no(&job_no));
73 printf("my job_no is %u", job_no);
74
75 next();
76 next();
77 next();
78
79 /* now overrun a job for good */
80 do_stuff();
81 do_stuff();
82 do_stuff();
83 do_stuff();
84 do_stuff();
85 do_stuff();
86 do_stuff();
87 do_stuff();
88 do_stuff();
89 do_stuff();
90
91
92 next();
93 next();
94 next();
95 next();
96 sync_jobs();
97 next();
98 next();
99 next();
100
101
102 return 0;
103}