1*cf78ab8cSAndroid Build Coastguard Worker@echo off 2*cf78ab8cSAndroid Build Coastguard Workersetlocal 3*cf78ab8cSAndroid Build Coastguard Worker 4*cf78ab8cSAndroid Build Coastguard Worker:: Get the directory of the script 5*cf78ab8cSAndroid Build Coastguard Workerset REPO=%~dp0\..\..\.. 6*cf78ab8cSAndroid Build Coastguard Worker 7*cf78ab8cSAndroid Build Coastguard Worker:: Get the Rust version, package, and objs path from arguments 8*cf78ab8cSAndroid Build Coastguard Workerset RUST_PKG=%1 9*cf78ab8cSAndroid Build Coastguard Workerset OUT_PATH=%2 10*cf78ab8cSAndroid Build Coastguard Workerset RUST_VERSION=%3 11*cf78ab8cSAndroid Build Coastguard Workerset OBJS_PATH=%OUT_PATH% 12*cf78ab8cSAndroid Build Coastguard Worker 13*cf78ab8cSAndroid Build Coastguard Worker:: Set environment variables 14*cf78ab8cSAndroid Build Coastguard Workerset PATH=%PATH%;%OUT_PATH%\lib64 15*cf78ab8cSAndroid Build Coastguard Workerset PATH=%PATH%;%REPO%\prebuilts\gcc\linux-x86\host\x86_64-w64-mingw32-4.8\x86_64-w64-mingw32\lib;%REPO%\prebuilts\gcc\linux-x86\host\x86_64-w64-mingw32-4.8\x86_64-w64-mingw32\bin 16*cf78ab8cSAndroid Build Coastguard Workerset CORROSION_BUILD_DIR=%OUT_PATH%/rust 17*cf78ab8cSAndroid Build Coastguard Workerset CARGO_BUILD_RUSTC=%REPO%/prebuilts/rust/windows-x86/%RUST_VERSION%/bin/rustc 18*cf78ab8cSAndroid Build Coastguard Workerset RUSTC=%REPO%/prebuilts/rust/windows-x86/%RUST_VERSION%/bin/rustc 19*cf78ab8cSAndroid Build Coastguard Workerset CARGO_HOME=%OUT_PATH%\rust\.cargo 20*cf78ab8cSAndroid Build Coastguard Workerset RUSTFLAGS=-Cdefault-linker-libraries=yes 21*cf78ab8cSAndroid Build Coastguard Workerset GRPCIO_SYS_GRPC_INCLUDE_PATH=%REPO%/external/grpc/include 22*cf78ab8cSAndroid Build Coastguard Worker 23*cf78ab8cSAndroid Build Coastguard Worker:: Paths to pdl generated packets files 24*cf78ab8cSAndroid Build Coastguard Workerset ROOTCANAL_PDL_PATH=%OUT_PATH%\rootcanal\pdl_gen 25*cf78ab8cSAndroid Build Coastguard Workerset LINK_LAYER_PACKETS_PREBUILT=%ROOTCANAL_PDL_PATH%\link_layer_packets.rs 26*cf78ab8cSAndroid Build Coastguard Workerset PDL_PATH=%OUT_PATH%\pdl\pdl_gen 27*cf78ab8cSAndroid Build Coastguard Workerset MAC80211_HWSIM_PACKETS_PREBUILT=%PDL_PATH%\mac80211_hwsim_packets.rs 28*cf78ab8cSAndroid Build Coastguard Workerset IEEE80211_PACKETS_PREBUILT=%PDL_PATH%\ieee80211_packets.rs 29*cf78ab8cSAndroid Build Coastguard Workerset LLC_PACKETS_PREBUILT=%PDL_PATH%\llc_packets.rs 30*cf78ab8cSAndroid Build Coastguard Workerset NETLINK_PACKETS_PREBUILT=%PDL_PATH%\netlink_packets.rs 31*cf78ab8cSAndroid Build Coastguard Worker 32*cf78ab8cSAndroid Build Coastguard Worker:: Run the cargo command 33*cf78ab8cSAndroid Build Coastguard Worker%REPO%\prebuilts\rust\windows-x86\%RUST_VERSION%\bin\cargo.exe test -vv --target=x86_64-pc-windows-gnu --config target.x86_64-pc-windows-gnu.linker='%OUT_PATH%\toolchain\ld-emu.cmd' --package %RUST_PKG% --manifest-path %REPO%\tools\netsim\rust\Cargo.toml --release -- --nocapture