From 6f44d9b7aff1abe25944315c68055ab424a72f78 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 29 Apr 2023 10:52:03 +0200 Subject: [PATCH 01/11] android: use cargo test instead of nextest nextest does build because of: 2023-04-29T08:03:36.5411530Z Compiling log v0.4.17 2023-04-29T08:03:36.5412100Z error[E0432]: unresolved import linux_raw_sys::ioctl 2023-04-29T08:03:36.5412710Z --> /data/data/com.termux/files/home/.cargo/registry/src/github.com-1285ae84e5963aae/rustix-0.37.17/src/backend/libc/io/syscalls.rs:384:24 2023-04-29T08:03:36.5413150Z | 2023-04-29T08:03:36.5413830Z 384 | use linux_raw_sys::ioctl::EXT4_IOC_RESIZE_FS; 2023-04-29T08:03:36.5414380Z | could not find ioctl in linux_raw_sys 2023-04-29T08:03:36.5414590Z 2023-04-29T08:03:36.5414840Z For more information about this error, try rustc --explain E0432. 2023-04-29T08:03:36.5415280Z error: could not compile rustix due to previous error 2023-04-29T08:03:36.5415730Z warning: build failed, waiting for other jobs to finish... https://github.com/nextest-rs/nextest/issues/862 --- util/android-commands.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/util/android-commands.sh b/util/android-commands.sh index ae579624322..5eae1639fb0 100755 --- a/util/android-commands.sh +++ b/util/android-commands.sh @@ -209,7 +209,7 @@ snapshot() { # We need to install nextest via cargo currently, since there is no pre-built binary for android x86 command="'\ export CARGO_TERM_COLOR=always; \ -cargo install cargo-nextest; \ +#cargo install cargo-nextest; \ echo \$? > $probe'" run_termux_command "$command" "$probe" return_code=$? @@ -224,7 +224,7 @@ pwd; \ command -v rustc && rustc -Vv; \ ls -la ~/.cargo/bin; \ cargo --list; \ -cargo nextest --version; \ +#cargo nextest --version; \ touch $probe'" run_termux_command "$command" "$probe" @@ -330,7 +330,8 @@ export CARGO_TERM_COLOR=always; \ export CARGO_INCREMENTAL=0; \ cd ~/coreutils; \ timeout --preserve-status --verbose -k 1m 60m \ - cargo nextest run --profile ci --hide-progress-bar --features feat_os_unix_android; \ + cargo test --features feat_os_unix_android; \ +# cargo nextest run --profile ci --hide-progress-bar --features feat_os_unix_android; \ echo \$? >$probe'" run_termux_command "$command" "$probe" || return From 0c9c54275e44a68273e925db594521952249afa3 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 29 Apr 2023 12:37:08 +0200 Subject: [PATCH 02/11] simplify it --- util/android-commands.sh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/util/android-commands.sh b/util/android-commands.sh index 5eae1639fb0..d9c07fb69b3 100755 --- a/util/android-commands.sh +++ b/util/android-commands.sh @@ -328,10 +328,7 @@ tests() { export RUST_BACKTRACE=1; \ export CARGO_TERM_COLOR=always; \ export CARGO_INCREMENTAL=0; \ -cd ~/coreutils; \ -timeout --preserve-status --verbose -k 1m 60m \ - cargo test --features feat_os_unix_android; \ -# cargo nextest run --profile ci --hide-progress-bar --features feat_os_unix_android; \ +cd ~/coreutils && cargo test --features feat_os_unix_android; \ echo \$? >$probe'" run_termux_command "$command" "$probe" || return From ffa2118717c268997c7170e6bd430666bf8e2e06 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 29 Apr 2023 12:47:48 +0200 Subject: [PATCH 03/11] add debug info --- util/android-commands.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/util/android-commands.sh b/util/android-commands.sh index d9c07fb69b3..a2d39220ce4 100755 --- a/util/android-commands.sh +++ b/util/android-commands.sh @@ -119,6 +119,7 @@ run_termux_command() { local retries=${retries:-3} local sleep_interval=${sleep_interval:-5} try_fix=3 + echo "run_termux_command with timeout=$timeout / retries=$retries / sleep_interval=$sleep_interval" while ! adb shell "ls $probe" 2>/dev/null; do echo -n "Waiting for $probe: " From 4e712140fe4e1b33a4a01ee5ef2f2e77a1cead8d Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 29 Apr 2023 18:48:10 +0200 Subject: [PATCH 04/11] Do not run test_closes_file_descriptors on android Closes: #4736 --- tests/by-util/test_cp.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index dfbbc1473a5..d658d9c2b1b 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -1542,7 +1542,7 @@ fn test_cp_reflink_insufficient_permission() { .stderr_only("cp: 'unreadable' -> 'existing_file.txt': Permission denied (os error 13)\n"); } -#[cfg(any(target_os = "linux", target_os = "android"))] +#[cfg(target_os = "linux")] #[test] fn test_closes_file_descriptors() { use procfs::process::Process; From ac068e0487d216ccc7c312ecc84697f92191eff5 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 29 Apr 2023 19:23:56 +0200 Subject: [PATCH 05/11] Disable test_sort::test_compress_fail & test_chmod::test_mode_after_dash_dash on android --- tests/by-util/test_chmod.rs | 1 + tests/by-util/test_sort.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/by-util/test_chmod.rs b/tests/by-util/test_chmod.rs index acba00854fb..697bc939eca 100644 --- a/tests/by-util/test_chmod.rs +++ b/tests/by-util/test_chmod.rs @@ -538,6 +538,7 @@ fn test_invalid_arg() { } #[test] +#[cfg(not(target_os = "android"))] fn test_mode_after_dash_dash() { let (at, ucmd) = at_and_ucmd!(); run_single_test( diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index a61db56b0f3..114907393d1 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -876,7 +876,7 @@ fn sort_empty_chunk() { } #[test] -#[cfg(any(target_os = "linux", target_os = "android"))] +#[cfg(target_os = "linux")] fn test_compress() { new_ucmd!() .args(&[ From ba8fa58a9a002d74f4230a3e09587ff61b93abd1 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 29 Apr 2023 19:49:44 +0200 Subject: [PATCH 06/11] android: increase the retries + sleep --- util/android-commands.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/android-commands.sh b/util/android-commands.sh index a2d39220ce4..d958215e582 100755 --- a/util/android-commands.sh +++ b/util/android-commands.sh @@ -116,8 +116,8 @@ run_termux_command() { sleep 5 local timeout=${timeout:-3600} - local retries=${retries:-3} - local sleep_interval=${sleep_interval:-5} + local retries=${retries:-10} + local sleep_interval=${sleep_interval:-10} try_fix=3 echo "run_termux_command with timeout=$timeout / retries=$retries / sleep_interval=$sleep_interval" while ! adb shell "ls $probe" 2>/dev/null; do From 53ae5c33c961be2d9309f6446f39e7c57460894a Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 29 Apr 2023 20:39:18 +0200 Subject: [PATCH 07/11] Disable test_sort::test_compress_fail (for real) & test_cp::test_cp_arg_interactive_update on android --- tests/by-util/test_cp.rs | 1 + tests/by-util/test_sort.rs | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index d658d9c2b1b..7a0743bd1c7 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -257,6 +257,7 @@ fn test_cp_arg_interactive() { } #[test] +#[cfg(not(target_os = "android"))] fn test_cp_arg_interactive_update() { // -u -i won't show the prompt to validate the override or not // Therefore, the error code will be 0 diff --git a/tests/by-util/test_sort.rs b/tests/by-util/test_sort.rs index 114907393d1..e66a405abbb 100644 --- a/tests/by-util/test_sort.rs +++ b/tests/by-util/test_sort.rs @@ -876,7 +876,7 @@ fn sort_empty_chunk() { } #[test] -#[cfg(target_os = "linux")] +#[cfg(any(target_os = "linux", target_os = "android"))] fn test_compress() { new_ucmd!() .args(&[ @@ -915,6 +915,7 @@ fn test_compress_merge() { } #[test] +#[cfg(not(target_os = "android"))] fn test_compress_fail() { #[cfg(not(windows))] TestScenario::new(util_name!()) From 9dff7d86cbf461391d4a3ee7e7fe3487f2ce3689 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 29 Apr 2023 21:29:47 +0200 Subject: [PATCH 08/11] Disable test_factor::test_parallel on android --- tests/by-util/test_factor.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/by-util/test_factor.rs b/tests/by-util/test_factor.rs index 59940e2e3a6..1c75413702f 100644 --- a/tests/by-util/test_factor.rs +++ b/tests/by-util/test_factor.rs @@ -35,6 +35,7 @@ fn test_valid_arg_exponents() { #[test] #[cfg(feature = "sort")] +#[cfg(not(target_os = "android"))] fn test_parallel() { use crate::common::util::AtPath; use hex_literal::hex; From 1055918c310be7b5b472cae7ccb102e415fb3d7d Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 30 Apr 2023 16:58:29 +0200 Subject: [PATCH 09/11] Document why we can't use nextest for now --- util/android-commands.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/android-commands.sh b/util/android-commands.sh index d958215e582..9f1d28db891 100755 --- a/util/android-commands.sh +++ b/util/android-commands.sh @@ -4,7 +4,7 @@ # There are three shells: the host's, adb, and termux. Only adb lets us run # commands directly on the emulated device, only termux provides a GNU # environment on the emulated device (to e.g. run cargo). So we use adb to -# launch termux, then to send keystrokes to it while it's running. +# launch termux, then to send keystrokes to it while it's ruMbdfhnRrVnning. # This means that the commands sent to termux are first parsed as arguments in # this shell, then as arguments in the adb shell, before finally being used as # text inputs to the app. Hence, the "'wrapping'" on those commands. @@ -210,7 +210,7 @@ snapshot() { # We need to install nextest via cargo currently, since there is no pre-built binary for android x86 command="'\ export CARGO_TERM_COLOR=always; \ -#cargo install cargo-nextest; \ +# build fails for now (https://github.com/nextest-rs/nextest/issues/862): cargo install cargo-nextest; \ echo \$? > $probe'" run_termux_command "$command" "$probe" return_code=$? From bbb218c0e273b696dc039c5e3013cfc0f46855b9 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 30 Apr 2023 17:21:34 +0200 Subject: [PATCH 10/11] Remove bad c/p --- util/android-commands.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/android-commands.sh b/util/android-commands.sh index 9f1d28db891..668815f7d07 100755 --- a/util/android-commands.sh +++ b/util/android-commands.sh @@ -4,7 +4,7 @@ # There are three shells: the host's, adb, and termux. Only adb lets us run # commands directly on the emulated device, only termux provides a GNU # environment on the emulated device (to e.g. run cargo). So we use adb to -# launch termux, then to send keystrokes to it while it's ruMbdfhnRrVnning. +# launch termux, then to send keystrokes to it while it's running. # This means that the commands sent to termux are first parsed as arguments in # this shell, then as arguments in the adb shell, before finally being used as # text inputs to the app. Hence, the "'wrapping'" on those commands. From 75e33695e5a187238773fc588bc28145637567c2 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 30 Apr 2023 20:08:06 +0200 Subject: [PATCH 11/11] Disable test_gnu_options on android --- tests/by-util/test_chmod.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/by-util/test_chmod.rs b/tests/by-util/test_chmod.rs index 697bc939eca..9e3c7d2da7f 100644 --- a/tests/by-util/test_chmod.rs +++ b/tests/by-util/test_chmod.rs @@ -650,6 +650,7 @@ fn test_gnu_invalid_mode() { } #[test] +#[cfg(not(target_os = "android"))] fn test_gnu_options() { let scene = TestScenario::new(util_name!()); let at = &scene.fixtures;