-
Notifications
You must be signed in to change notification settings - Fork 2
/
test.c
48 lines (38 loc) · 1.14 KB
/
test.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <stdio.h>
#include <cmssys.h>
#include <signal.h>
void signal_handler(int signal) {
printf("Received signal %d\n", signal);
}
void fnExit1(void) {
printf("Exit function 1\n");
}
void fnExit2(void) {
printf("Exit function 2\n");
}
int main(int argc, char *argv[]) {
printf("GCCLIB Sanity Test\n");
printf("Immediate Flags Test\n");
CMSSetFlag(TRACEFLAG, 0);
CMSSetFlag(HALTFLAG, 0);
printf("Trace %d\n", CMSGetFlag(TRACEFLAG));
printf("Halt %d\n", CMSGetFlag(HALTFLAG));
CMSSetFlag(TRACEFLAG, 1);
CMSSetFlag(HALTFLAG, 1);
printf("Trace %d\n", CMSGetFlag(TRACEFLAG));
printf("Halt %d\n", CMSGetFlag(HALTFLAG));
CMSSetFlag(TRACEFLAG, 0);
CMSSetFlag(HALTFLAG, 1);
printf("Trace %d\n", CMSGetFlag(TRACEFLAG));
printf("Halt %d\n", CMSGetFlag(HALTFLAG));
CMSSetFlag(TRACEFLAG, 1);
CMSSetFlag(HALTFLAG, 0);
printf("Trace %d\n", CMSGetFlag(TRACEFLAG));
printf("Halt %d\n", CMSGetFlag(HALTFLAG));
printf("Signal Test\n");
signal(SIGTERM, signal_handler);
raise(SIGTERM);
printf("Test Exit Functions (order 2,1)\n");
atexit(fnExit1);
atexit(fnExit2);
}