@@ -1191,11 +1191,24 @@ macro_rules! docker_command {
1191
1191
} ) ;
1192
1192
}
1193
1193
1194
- #[ cfg( target_arch = "x86_64" ) ]
1195
- const DOCKER_ARCH : & str = "linux/amd64" ;
1194
+ macro_rules! docker_target_arch {
1195
+ ( x86_64: $x: expr, aarch64: $a: expr $( , ) ?) => { {
1196
+ #[ cfg( target_arch = "x86_64" ) ]
1197
+ {
1198
+ $x
1199
+ }
1196
1200
1197
- #[ cfg( target_arch = "aarch64" ) ]
1198
- const DOCKER_ARCH : & str = "linux/arm64" ;
1201
+ #[ cfg( target_arch = "aarch64" ) ]
1202
+ {
1203
+ $a
1204
+ }
1205
+ } } ;
1206
+ }
1207
+
1208
+ const DOCKER_ARCH : & str = docker_target_arch ! {
1209
+ x86_64: "linux/amd64" ,
1210
+ aarch64: "linux/arm64" ,
1211
+ } ;
1199
1212
1200
1213
fn basic_secure_docker_command ( ) -> Command {
1201
1214
docker_command ! (
@@ -1765,11 +1778,10 @@ mod tests {
1765
1778
1766
1779
let response = coordinator. compile ( req) . with_timeout ( ) . await . unwrap ( ) ;
1767
1780
1768
- #[ cfg( target_arch = "x86_64" ) ]
1769
- let asm = "eax, [rsi + rdi]" ;
1770
-
1771
- #[ cfg( target_arch = "aarch64" ) ]
1772
- let asm = "w0, w1, w0" ;
1781
+ let asm = docker_target_arch ! {
1782
+ x86_64: "eax, [rsi + rdi]" ,
1783
+ aarch64: "w0, w1, w0" ,
1784
+ } ;
1773
1785
1774
1786
assert ! ( response. success, "stderr: {}" , response. stderr) ;
1775
1787
assert_contains ! ( response. code, asm) ;
0 commit comments