Skip to content

Commit e238207

Browse files
authored
Merge pull request #176 from ojeda/semaphore
Normalize semaphore samples and add them to the CI
2 parents 2bd985a + 0dcf40f commit e238207

13 files changed

+73
-15
lines changed

.github/workflows/ci.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,14 @@ jobs:
301301
grep '] rust_stack_probing: Rust stack probing sample (init)$' qemu-stdout.log
302302
grep '] rust_stack_probing: Rust stack probing sample (exit)$' qemu-stdout.log
303303
304+
- run: |
305+
grep '] rust_semaphore: Rust semaphore sample (init)$' qemu-stdout.log
306+
grep '] rust_semaphore: Rust semaphore sample (exit)$' qemu-stdout.log
307+
308+
- run: |
309+
grep '] rust_semaphore_c: Rust semaphore sample (in C, for comparison) (init)$' qemu-stdout.log
310+
grep '] rust_semaphore_c: Rust semaphore sample (in C, for comparison) (exit)$' qemu-stdout.log
311+
304312
# Report
305313
- run: |
306314
ls -l \

.github/workflows/kernel-arm64-debug.config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1427,6 +1427,8 @@ CONFIG_SAMPLE_RUST_SYNC=m
14271427
CONFIG_SAMPLE_RUST_CHRDEV=m
14281428
CONFIG_SAMPLE_RUST_MISCDEV=m
14291429
CONFIG_SAMPLE_RUST_STACK_PROBING=m
1430+
CONFIG_SAMPLE_RUST_SEMAPHORE=m
1431+
CONFIG_SAMPLE_RUST_SEMAPHORE_C=m
14301432

14311433
#
14321434
# arm64 Debugging

.github/workflows/kernel-arm64-release.config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1345,6 +1345,8 @@ CONFIG_SAMPLE_RUST_SYNC=m
13451345
CONFIG_SAMPLE_RUST_CHRDEV=m
13461346
CONFIG_SAMPLE_RUST_MISCDEV=m
13471347
CONFIG_SAMPLE_RUST_STACK_PROBING=m
1348+
CONFIG_SAMPLE_RUST_SEMAPHORE=m
1349+
CONFIG_SAMPLE_RUST_SEMAPHORE_C=m
13481350

13491351
#
13501352
# arm64 Debugging

.github/workflows/kernel-ppc64le-debug.config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1487,6 +1487,8 @@ CONFIG_SAMPLE_RUST_SYNC=m
14871487
CONFIG_SAMPLE_RUST_CHRDEV=m
14881488
CONFIG_SAMPLE_RUST_MISCDEV=m
14891489
CONFIG_SAMPLE_RUST_STACK_PROBING=m
1490+
CONFIG_SAMPLE_RUST_SEMAPHORE=m
1491+
CONFIG_SAMPLE_RUST_SEMAPHORE_C=m
14901492
CONFIG_ARCH_HAS_DEVMEM_IS_ALLOWED=y
14911493
# CONFIG_STRICT_DEVMEM is not set
14921494

.github/workflows/kernel-ppc64le-release.config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1449,6 +1449,8 @@ CONFIG_SAMPLE_RUST_SYNC=m
14491449
CONFIG_SAMPLE_RUST_CHRDEV=m
14501450
CONFIG_SAMPLE_RUST_MISCDEV=m
14511451
CONFIG_SAMPLE_RUST_STACK_PROBING=m
1452+
CONFIG_SAMPLE_RUST_SEMAPHORE=m
1453+
CONFIG_SAMPLE_RUST_SEMAPHORE_C=m
14521454
CONFIG_ARCH_HAS_DEVMEM_IS_ALLOWED=y
14531455
# CONFIG_STRICT_DEVMEM is not set
14541456

.github/workflows/kernel-x86_64-debug.config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1439,6 +1439,8 @@ CONFIG_SAMPLE_RUST_SYNC=m
14391439
CONFIG_SAMPLE_RUST_CHRDEV=m
14401440
CONFIG_SAMPLE_RUST_MISCDEV=m
14411441
CONFIG_SAMPLE_RUST_STACK_PROBING=m
1442+
CONFIG_SAMPLE_RUST_SEMAPHORE=m
1443+
CONFIG_SAMPLE_RUST_SEMAPHORE_C=m
14421444
CONFIG_ARCH_HAS_DEVMEM_IS_ALLOWED=y
14431445
# CONFIG_STRICT_DEVMEM is not set
14441446

.github/workflows/kernel-x86_64-release.config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1387,6 +1387,8 @@ CONFIG_SAMPLE_RUST_SYNC=m
13871387
CONFIG_SAMPLE_RUST_CHRDEV=m
13881388
CONFIG_SAMPLE_RUST_MISCDEV=m
13891389
CONFIG_SAMPLE_RUST_STACK_PROBING=m
1390+
CONFIG_SAMPLE_RUST_SEMAPHORE=m
1391+
CONFIG_SAMPLE_RUST_SEMAPHORE_C=m
13901392
CONFIG_ARCH_HAS_DEVMEM_IS_ALLOWED=y
13911393
# CONFIG_STRICT_DEVMEM is not set
13921394

.github/workflows/qemu-init.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ busybox rmmod rust_miscdev.ko
2121
busybox insmod rust_stack_probing.ko
2222
busybox rmmod rust_stack_probing.ko
2323

24+
busybox insmod rust_semaphore.ko
25+
busybox rmmod rust_semaphore.ko
26+
27+
busybox insmod rust_semaphore_c.ko
28+
busybox rmmod rust_semaphore_c.ko
29+
2430
busybox insmod rust_module_parameters_loadable_default.ko
2531
busybox insmod rust_module_parameters_loadable_custom.ko \
2632
my_bool=n \

.github/workflows/qemu-initramfs.desc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ file /rust_sync.ko samples/rust/rust_sync.ko 0755
1212
file /rust_chrdev.ko samples/rust/rust_chrdev.ko 0755 0 0
1313
file /rust_miscdev.ko samples/rust/rust_miscdev.ko 0755 0 0
1414
file /rust_stack_probing.ko samples/rust/rust_stack_probing.ko 0755 0 0
15+
file /rust_semaphore.ko samples/rust/rust_semaphore.ko 0755 0 0
16+
file /rust_semaphore_c.ko samples/rust/rust_semaphore_c.ko 0755 0 0
1517

1618
file /rust_module_parameters_loadable_default.ko samples/rust/rust_module_parameters_loadable_default.ko 0755 0 0
1719
file /rust_module_parameters_loadable_custom.ko samples/rust/rust_module_parameters_loadable_custom.ko 0755 0 0

samples/rust/Kconfig

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,20 +80,24 @@ config SAMPLE_RUST_STACK_PROBING
8080

8181
If unsure, say N.
8282

83-
config SAMPLE_SEMAPHORE
84-
tristate "Semaphore in C"
83+
config SAMPLE_RUST_SEMAPHORE
84+
tristate "Semaphore"
8585
help
86-
This option builds the C semaphore sample.
86+
This option builds the Rust semaphore sample.
8787

8888
To compile this as a module, choose M here:
89-
the module will be called semaphore.
89+
the module will be called rust_semaphore.
9090

91-
config SAMPLE_RUST_SEMAPHORE
92-
tristate "Semaphore in Rust"
91+
If unsure, say N.
92+
93+
config SAMPLE_RUST_SEMAPHORE_C
94+
tristate "Semaphore (in C, for comparison)"
9395
help
94-
This option builds the Rust semaphore sample.
96+
This option builds the Rust semaphore sample (in C, for comparison).
9597

9698
To compile this as a module, choose M here:
97-
the module will be called rust_semaphore.
99+
the module will be called rust_semaphore_c.
100+
101+
If unsure, say N.
98102

99103
endif # SAMPLES_RUST

0 commit comments

Comments
 (0)