Skip to content

Commit 9b8c4b6

Browse files
atar13Samir-Rashid
authored andcommitted
organized echo and print tests
1 parent e67d69d commit 9b8c4b6

6 files changed

Lines changed: 69 additions & 3 deletions

File tree

tests/add/add.arm.s

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,16 @@
22
.text
33

44
.global _start
5+
.global _main
56

7+
.balign 4
68
_start:
79
bl main
810
mov x8, #93
911
svc #0
1012

13+
.balign 4
14+
_main:
1115
main:
1216

1317
sub sp, sp, 32

tests/echo/echo.arm.s

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
2+
.text
3+
4+
.global _start
5+
.global _main
6+
7+
.balign 4
8+
_start:
9+
bl main
10+
mov x8, #93
11+
svc #0
12+
13+
.balign 4
14+
_main:
15+
main:
16+
17+
sub sp, sp, 32
18+
mov x8, 63
19+
mov x2, 32
20+
add x1, sp, 0
21+
mov x0, 0
22+
svc 0
23+
mov x8, 64
24+
mov x2, 14
25+
add x1, sp, 0
26+
mov x0, 1
27+
svc 0
28+
mov x8, 93
29+
svc 0
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,6 @@ mod tests {
6868
RiscVInstruction::ECall,
6969
];
7070

71-
translate_to_file(riscv_asm, "test_binary_translate_echo.S".to_string());
71+
translate_to_file(riscv_asm, "./tests/echo/echo.arm.s".to_string());
7272
}
7373
}

tests/print/print.arm.s

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
2+
.buf:
3+
.string "hello world\n"
4+
5+
6+
.text
7+
8+
.global _start
9+
.global _main
10+
11+
.balign 4
12+
_start:
13+
bl main
14+
mov x8, #93
15+
svc #0
16+
17+
.balign 4
18+
_main:
19+
main:
20+
21+
mov x8, 64
22+
mov x2, 14
23+
adrp x0, .buf
24+
add x1, x0, :lo12:.buf
25+
mov x0, 1
26+
svc 0
27+
mov x8, 93
28+
svc 0
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,6 @@ mod tests {
5858
RiscVInstruction::ECall,
5959
];
6060

61-
translate_to_file(riscv_asm, "test_binary_translate_print.S".to_string());
61+
translate_to_file(riscv_asm, "./tests/print/print.arm.s".to_string());
6262
}
6363
}

tests/tests.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1-
21
#[path = "add/test_add.rs"]
32
mod add;
3+
4+
#[path = "echo/test_echo.rs"]
5+
mod echo;
6+
7+
#[path = "print/test_print.rs"]
8+
mod print;

0 commit comments

Comments
 (0)