修訂 | 486e58b188c1b093a8f64d4b5cd11ff5c3514cb2 (tree) |
---|---|
時間 | 2020-01-09 20:41:29 |
作者 | Alex Bennée <alex.bennee@lina...> |
Commiter | Alex Bennée |
tests/tcg: add user version of dumb-as-bricks semiconsole test
There are linux-user users of semihosting so we'd better check things
work for them as well.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
@@ -32,4 +32,11 @@ run-plugin-semihosting-with-%: | ||
32 | 32 | $(call strip-plugin,$<) 2> $<.err, \ |
33 | 33 | "$< on $(TARGET_NAME) with $*") |
34 | 34 | |
35 | +AARCH64_TESTS += semiconsole | |
36 | +run-semiconsole: semiconsole | |
37 | + $(call skip-test, $<, "MANUAL ONLY") | |
38 | + | |
39 | +run-plugin-semiconsole-with-%: | |
40 | + $(call skip-test, $<, "MANUAL ONLY") | |
41 | + | |
35 | 42 | TESTS += $(AARCH64_TESTS) |
@@ -49,6 +49,25 @@ run-plugin-semihosting-with-%: | ||
49 | 49 | $(call strip-plugin,$<) 2> $<.err, \ |
50 | 50 | "$< on $(TARGET_NAME) with $*") |
51 | 51 | |
52 | +ARM_TESTS += semiconsole semiconsole-arm | |
53 | + | |
54 | +semiconsole: CFLAGS += -mthumb | |
55 | +run-semiconsole: semiconsole | |
56 | + $(call skip-test, $<, "MANUAL ONLY") | |
57 | + | |
58 | +run-plugin-semiconsole-with-%: | |
59 | + $(call skip-test, $<, "MANUAL ONLY") | |
60 | + | |
61 | +semiconsole-arm: CFLAGS += -marm | |
62 | +semiconsole-arm: semiconsole.c | |
63 | + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS) | |
64 | + | |
65 | +run-semiconsole-arm: semiconsole-arm | |
66 | + $(call skip-test, $<, "MANUAL ONLY") | |
67 | + | |
68 | +run-plugin-semiconsole-arm-with-%: | |
69 | + $(call skip-test, $<, "MANUAL ONLY") | |
70 | + | |
52 | 71 | TESTS += $(ARM_TESTS) |
53 | 72 | |
54 | 73 | # On ARM Linux only supports 4k pages |
@@ -0,0 +1,27 @@ | ||
1 | +/* | |
2 | + * linux-user semihosting console | |
3 | + * | |
4 | + * Copyright (c) 2019 | |
5 | + * Written by Alex Bennée <alex.bennee@linaro.org> | |
6 | + * | |
7 | + * SPDX-License-Identifier: GPL-3.0-or-later | |
8 | + */ | |
9 | + | |
10 | +#include <stdio.h> | |
11 | +#include <stdint.h> | |
12 | +#include "semicall.h" | |
13 | + | |
14 | +int main(void) | |
15 | +{ | |
16 | + char c; | |
17 | + | |
18 | + printf("Semihosting Console Test\n"); | |
19 | + printf("hit X to exit:"); | |
20 | + | |
21 | + do { | |
22 | + c = __semi_call(SYS_READC, 0); | |
23 | + printf("got '%c'\n", c); | |
24 | + } while (c != 'X'); | |
25 | + | |
26 | + return 0; | |
27 | +} |