xref: /aosp_15_r20/external/OpenCL-ICD-Loader/test/loader_test/icd_test_match.c (revision 1cddb830dba8aa7c1cc1039338e56b3b9fa24952)
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
4 #ifndef __APPLE__
5 #include <malloc.h>
6 #endif
7 #include <platform/icd_test_log.h>
8 
test_icd_match()9 int test_icd_match()
10 {
11     int error = 0;
12     char *app_log = NULL, *stub_log = NULL;
13 
14     app_log = test_icd_get_app_log();
15     if (!app_log) {
16         printf("ERROR: Could not retrieve app log\n");
17         error = 1;
18         goto End;
19     }
20 
21     stub_log = test_icd_get_stub_log();
22     if (!stub_log) {
23         printf("ERROR: Could not retrieve stub log\n");
24         error = 1;
25         goto End;
26     }
27 
28     if (strcmp(app_log, stub_log)) {
29         printf("ERROR: App log and stub log differ.\n\n");
30         printf("APPLOG:\n%s\n\n", app_log);
31         printf("STUBLOG:\n%s\n\n", stub_log);
32         error = 1;
33         goto End;
34     }
35 
36 End:
37     free(app_log);
38     free(stub_log);
39     return error;
40 }
41