Skip to content

Commit 42f6a6a

Browse files
committed
Update examples and ci
1 parent d74e55e commit 42f6a6a

File tree

6 files changed

+35
-2
lines changed

6 files changed

+35
-2
lines changed

.github/workflows/ci.yaml

+10-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,11 @@ jobs:
165165
-smp 2 \
166166
-nographic \
167167
-no-reboot \
168-
-append '${{ env.QEMU_APPEND }} rust_example.my_i32=123321 rust_example.my_str=🦀mod rust_example_2.my_i32=234432' \
168+
-append '${{ env.QEMU_APPEND }} \
169+
rust_example.my_i32=123321 \
170+
rust_example.my_str=🦀mod \
171+
rust_example_2.my_i32=234432 \
172+
rust_example_2.my_array=1,2,3' \
169173
| sed s:$'\r'$:: \
170174
| tee qemu-stdout.log
171175
@@ -191,6 +195,11 @@ jobs:
191195
grep '] \[3] my_str: 🦀mod$' qemu-stdout.log
192196
grep '] \[4] my_str: default str val$' qemu-stdout.log
193197
198+
grep '] my_array: [0, 1]$' qemu-stdout.log
199+
grep '] \[2] my_array: [1, 2, 3]$' qemu-stdout.log
200+
grep '] \[3] my_array: [0, 1]$' qemu-stdout.log
201+
grep '] \[4] my_array: [1, 2, 3]$' qemu-stdout.log
202+
194203
grep '] \[3] Rust Example (exit)$' qemu-stdout.log
195204
grep '] \[4] Rust Example (exit)$' qemu-stdout.log
196205

.github/workflows/qemu-init.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
22

33
busybox insmod rust_example_3.ko my_i32=345543 my_str=🦀mod
4-
busybox insmod rust_example_4.ko my_i32=456654 my_usize=84
4+
busybox insmod rust_example_4.ko my_i32=456654 my_usize=84 my_array=1,2,3
55
busybox rmmod rust_example_3.ko
66
busybox rmmod rust_example_4.ko
77

drivers/char/rust_example.rs

+6
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ module! {
4343
permissions: 0o644,
4444
description: b"Example of usize",
4545
},
46+
my_array: ArrayParam<i32, 3> {
47+
default: [0, 1],
48+
permissions: 0,
49+
description: b"Example of array",
50+
},
4651
},
4752
}
4853

@@ -79,6 +84,7 @@ impl KernelModule for RustExample {
7984
core::str::from_utf8(my_str.read(&lock))?
8085
);
8186
println!(" my_usize: {}", my_usize.read(&lock));
87+
println!(" my_array: {:?}", my_array.read());
8288
}
8389

8490
// Test mutexes.

drivers/char/rust_example_2.rs

+6
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ module! {
3333
permissions: 0o644,
3434
description: b"Example of usize",
3535
},
36+
my_array: ArrayParam<i32, 3> {
37+
default: [0, 1],
38+
permissions: 0,
39+
description: b"Example of array",
40+
},
3641
},
3742
}
3843

@@ -54,6 +59,7 @@ impl KernelModule for RustExample2 {
5459
core::str::from_utf8(my_str.read(&lock))?
5560
);
5661
println!("[2] my_usize: {}", my_usize.read(&lock));
62+
println!("[2] my_array: {:?}", my_array.read());
5763
}
5864

5965
// Including this large variable on the stack will trigger

drivers/char/rust_example_3.rs

+6
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ module! {
3333
permissions: 0o644,
3434
description: b"Example of usize",
3535
},
36+
my_array: ArrayParam<i32, 3> {
37+
default: [0, 1],
38+
permissions: 0,
39+
description: b"Example of array",
40+
},
3641
},
3742
}
3843

@@ -54,6 +59,7 @@ impl KernelModule for RustExample3 {
5459
core::str::from_utf8(my_str.read(&lock))?
5560
);
5661
println!("[3] my_usize: {}", my_usize.read(&lock));
62+
println!("[3] my_array: {:?}", my_array.read());
5763
}
5864

5965
// Including this large variable on the stack will trigger

drivers/char/rust_example_4.rs

+6
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ module! {
3333
permissions: 0o644,
3434
description: b"Example of usize",
3535
},
36+
my_array: ArrayParam<i32, 3> {
37+
default: [0, 1],
38+
permissions: 0,
39+
description: b"Example of array",
40+
},
3641
},
3742
}
3843

@@ -54,6 +59,7 @@ impl KernelModule for RustExample4 {
5459
core::str::from_utf8(my_str.read(&lock))?
5560
);
5661
println!("[4] my_usize: {}", my_usize.read(&lock));
62+
println!("[4] my_array: {:?}", my_array.read());
5763
}
5864

5965
// Including this large variable on the stack will trigger

0 commit comments

Comments
 (0)