-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_parallel.c
85 lines (76 loc) · 1.92 KB
/
test_parallel.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#include "fuzz_interface.h"
#include <stdio.h>
#include <pthread.h>
int test(char *name)
{
valid_types_ptr valid_types = find_connection_types(name);
if (!valid_types) {
printf("failed!\n");
return -1;
}
for (uint32_t i = 0; i < valid_types->size; i++) {
printf("%u\n", valid_types->types[i]);
}
FILE *logfile = fopen("logfile.txt","w");
if (!logfile) {
printf("failed to create file\n");
perror("fopen");
return 0;
}
fprintf (logfile, "this is the logfile for the crash\n");
fclose(logfile);
for (uint32_t i = 0; i < valid_types->size; i++) {
printf("Type: %u\n", valid_types->types[i]);
FILE *logfile = fopen("logfile.txt","a");
if (!logfile) {
printf("failed to create file\n");
perror("fopen");
return 0;
}
fprintf (logfile, "type: %u\n",valid_types->types[i]);
fclose(logfile);
io_connect_t io_connection = get_user_client(name,valid_types->types[i]);
if(io_connection == IO_OBJECT_NULL){
printf("failed to get the user client\n");
continue;
}
if (IOCCM_fuzz_selectors(io_connection)) {
//this should never happen!
printf("what?\n");
}
IOServiceClose(io_connection);
}
// if(argc < 2)
// {
// printf("requires 1 argument!\n");
// return 0;
// }
// io_connect_t io_connection = get_user_client("IntelAccelerator",);
// if(io_connection == IO_OBJECT_NULL){
// printf("failed to get the user client\n");
// return 0;
// }
// IOCCM_fuzz_selectors(io_connection);
// IOServiceClose(io_connection);
return 0;
}
int main(int argc, char** argv){
if(argc < 2)
{
printf("requires 1 argument!\n");
return 0;
}
pid_t child_pid = fork();
if (child_pid == -1) {
printf("fork failed\n");
return 0;
}
printf("got service\n");
pthread_t th;
pthread_create(&th, NULL, test, argv[1]);
while(1){;}
pthread_join(th, NULL);
int loc = 0;
wait(&loc);
return 0;
}