-
Notifications
You must be signed in to change notification settings - Fork 6
/
ctest-bare.c
58 lines (44 loc) · 1.02 KB
/
ctest-bare.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
#include <stdio.h>
#include <stdbool.h>
#include <stdint.h>
#include <unistd.h>
#include <assert.h>
#include "testcalls.h"
#include "sys.h"
#include "libverif/verif.h"
#include "libverif/verif.h"
extern void plat_init(void);
extern void uart_init(void);
extern int uart_putchar(int c);
#define xstr(s) str(s)
#define str(s) #s
static const char arch_str[] = xstr(__BOARD__) "-" xstr(__UNIT__);
/* Override the default write from libc. */
int write(int fd, const void *buf, size_t count)
{
char *cbuf = (char *) buf;
size_t pos = 0;
while (count > 0) {
uart_putchar(cbuf[pos++]);
count--;
}
return pos;
}
int main(void)
{
int nr_tests;
uart_init();
printf("\nTBM %s %s running on %s\n", __DATE__, __TIME__, arch_str);
arch_init();
plat_init();
nr_tests = __testcalls_exec();
if (nr_tests)
printf("\n** %s: All %d directed testsuites passed.\n", arch_str, nr_tests);
app_run();
printf("** %s: Run CRT tests (may run forver)\n", arch_str);
crt_run_all();
puts("\n\t- halt\n");
while (1)
cpu_wfi();
return 0;
}