Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

completions::bash test failing under Alpine since 1.28.0 #2325

Open
strophy opened this issue Aug 27, 2024 · 5 comments
Open

completions::bash test failing under Alpine since 1.28.0 #2325

strophy opened this issue Aug 27, 2024 · 5 comments

Comments

@strophy
Copy link

strophy commented Aug 27, 2024

Hi, I started using just recently and absolutely love it. I'm trying to update the package for Alpine to the latest, since it is currently at 1.26.0. I'm able to build 1.27.0, but 1.28.0 fails with the following error during tests:

......
test working_directory::search_dir_child ... ok
test working_directory::search_dir_parent ... ok
test unstable::set_unstable_true_with_env_var ... ok
test readme::readme ... ok
   Compiling blake3 v1.5.1
   Compiling just v1.28.0 (/home/builder/package/src/just-1.28.0)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 9.99s
fatal: not a git repository (or any of the parent directories): .git
test_complete_all_recipes: failed! Completion for `just` does not match.

--- expected
+++ actual
@@ -1 +1 @@
-declare -a COMPREPLY=([0]="deploy" [1]="install" [2]="publish" [3]="push" [4]="test")
+declare -a COMPREPLY=()


test_complete_recipes_starting_with_i: failed! Completion for `just i` does not match.
--- expected
+++ actual
@@ -1 +1 @@
-declare -a COMPREPLY=([0]="install")
+declare -a COMPREPLY=()

test_complete_recipes_starting_with_p: failed! Completion for `just p` does not match.

--- expected
+++ actual
@@ -1 +1 @@
-declare -a COMPREPLY=([0]="publish" [1]="push")
+declare -a COMPREPLY=()


test_complete_recipes_from_subdirs: failed! Completion for `just subdir/` does not match.
--- expected
+++ actual
@@ -1 +1 @@
-declare -a COMPREPLY=([0]="subdir/special" [1]="subdir/surprise")
+declare -a COMPREPLY=([0]="subdir/")

Some test[s] failed.
test completions::bash ... FAILED

failures:

---- completions::bash stdout ----
thread 'completions::bash' panicked at tests/completions.rs:26:3:
assertion failed: status.success()
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


failures:
    completions::bash

test result: FAILED. 716 passed; 1 failed; 7 ignored; 0 measured; 3 filtered out; finished in 10.09s

I suspect it is probably related to #2104 or #2120, unless that .git error is the underlying cause? Thought I would post here to see if anyone has come across this before digging deeper. My APKBUILD file for 1.28.0 currently looks like this:

# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=just
pkgver=1.28.0
pkgrel=0
pkgdesc="Just a command runner"
url="https://github.com/casey/just"
# riscv64: rust currently broken on this arch
# s390x: blocked by nix crate
arch="all !riscv64 !s390x"
license="CC0-1.0"
checkdepends="bash fzf python3"
makedepends="cargo cargo-auditable"
subpackages="
	$pkgname-doc
	$pkgname-bash-completion
	$pkgname-fish-completion
	$pkgname-zsh-completion
	"
source="https://github.com/casey/just/archive/$pkgver/just-$pkgver.tar.gz"

export CARGO_PROFILE_RELEASE_OPT_LEVEL="z"

prepare() {
	default_prepare

	cargo fetch --target="$CTARGET" --locked
}

build() {
	cargo auditable build --release --frozen
}

check() {
	# Skipped tests are somehow broken.
	cargo test --frozen -- \
		--skip choose::default \
		--skip edit::editor_precedence \
		--skip functions::env_var_functions
}

package() {
	install -D -m755 target/release/just -t "$pkgdir"/usr/bin/

	install -D -m644 man/just.1 -t "$pkgdir"/usr/share/man/man1/

	install -D -m644 completions/just.bash \
		"$pkgdir"/usr/share/bash-completion/completions/$pkgname
	install -D -m644 completions/just.fish \
		"$pkgdir"/usr/share/fish/vendor_completions.d/$pkgname.fish
	install -D -m644 completions/just.zsh \
		"$pkgdir"/usr/share/zsh/site-functions/_$pkgname
}

sha512sums="
b6a5973689de88bb25acb3dfa601a2c2ecfa7df48afc3062ecd82cf64efa44f42e26270be1791037e87d2687e44e433ac33b18bc3fe0383279519342d0c5423a  just-1.28.0.tar.gz
"

Thanks for any help!

@casey
Copy link
Owner

casey commented Aug 27, 2024

Thanks for reporting this! Do master and the latest released version, 1.34, fail with the same error? That test tries to interactively make sure that bash completions are working, so it's probably sensitive to which version of bash is installed.

@strophy
Copy link
Author

strophy commented Aug 29, 2024

The error building 1.34.0 appears in the middle of the test output rather than the end, but other than that is identical:

test fmt::recipe_parameter_conditional ... ok
test fmt::recipe_parameter_default ... ok
test fmt::recipe_parameter_concat ... ok

test fmt::recipe_parameter_default_envar ... ok
test_complete_all_recipes: failed! Completion for `just` does not match.
test fmt::recipe_parameter_envar ... ok

test fmt::recipe_parameter_in_body ... ok
--- expected
+++ actual
@@ -1 +1 @@
-declare -a COMPREPLY=([0]="deploy" [1]="install" [2]="publish" [3]="push" [4]="test")
+declare -a COMPREPLY=()
test fmt::recipe_parameters ... ok
test fmt::recipe_parameters_envar ... ok
test fmt::recipe_quiet ... ok
test fmt::recipe_quiet_command ... ok

test_complete_recipes_starting_with_i: failed! Completion for `just i` does not match.
test fmt::recipe_positional_variadic ... ok
--- expected
+++ actual
@@ -1 +1 @@
-declare -a COMPREPLY=([0]="install")
+declare -a COMPREPLY=()

test fmt::recipe_quiet_comment ... ok
test fmt::recipe_several_commands ... ok

test_complete_recipes_starting_with_p: failed! Completion for `just p` does not match.
test fmt::recipe_variadic_plus ... ok
test fmt::recipe_variadic_default ... ok
test fmt::unstable_not_passed ... ok
--- expected
+++ actual
@@ -1 +1 @@
-declare -a COMPREPLY=([0]="publish" [1]="push")
+declare -a COMPREPLY=()

test fmt::unstable_passed ... ok
test fmt::separate_recipes_aliases ... ok
test fmt::recipe_with_docstring ... ok
test fmt::recipe_with_comments_in_body ... ok
test fmt::recipe_variadic_star ... ok
test fmt::set_false ... ok
test fmt::set_true_explicit ... ok
test fmt::set_shell ... ok
test_complete_recipes_from_subdirs: failed! Completion for `just subdir/` does not match.

test fmt::set_true_implicit ... ok
test functions::broken_directory_function2 ... ok
test functions::broken_directory_function ... ok
--- expected
test functions::broken_file_stem_function ... ok
+++ actual
@@ -1 +1 @@
-declare -a COMPREPLY=([0]="subdir/special" [1]="subdir/surprise")
+declare -a COMPREPLY=([0]="subdir/")

test functions::broken_extension_function2 ... ok
Some test[s] failed.
test functions::broken_extension_function ... ok
test functions::broken_without_extension_function ... ok
test functions::broken_file_name_function ... ok
test fmt::subsequent ... ok
test fmt::write_error ... ok
test completions::bash ... FAILED
test functions::choose_bad_alphabet_empty ... ok
test functions::blake3 ... ok
test functions::choose_bad_length ... ok
test functions::blake3_file ... ok
........
........
test working_directory::working_dir_applies_to_backticks ... ok
test unstable::set_unstable_true_with_env_var ... ok
test working_directory::working_dir_applies_to_shell_function ... ok
test working_directory::working_dir_applies_to_backticks_in_submodules ... ok
test working_directory::setting ... ok
test working_directory::working_dir_applies_to_shell_function_in_submodules ... ok
test working_directory::working_dir_in_submodule_is_relative_to_module_path ... ok
test readme::readme ... ok

failures:

---- completions::bash stdout ----
thread 'completions::bash' panicked at tests/completions.rs:26:3:
assertion failed: status.success()
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


failures:
    completions::bash

test result: FAILED. 795 passed; 1 failed; 7 ignored; 0 measured; 3 filtered out; finished in 1.43s

I think it's just due to Rust parallelism and waiting for all jobs to finish. I'm not sure how to build from master unfortunately due to the way abuild works. The bash version in use is shown while setting up the environment as (12/28) Installing bash (5.2.26-r0).

I tried manually running the build in the build environment, and then manually running the test:

/home/builder/package/just-1.34.0 # target/release/just --completions bash > completions.bash
/home/builder/package/just-1.34.0 # tests/completions/just.bash /home/builder/package/just-1.34.0/completi
ons.bash 
warning: /home/builder/package/just-1.34.0/Cargo.toml: unused manifest key: lints.rust.unexpected_cfgs.check-cfg
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.15s
fatal: not a git repository (or any parent up to mount point /home/builder)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
test_complete_all_recipes: ok
test_complete_recipes_starting_with_i: ok
test_complete_recipes_starting_with_p: ok
test_complete_recipes_from_subdirs: ok
All tests passed.

Maybe something related to temp file handling when running in abuild? I'm starting to think we can disable this test like the three others already disabled for Alpine builds, the output itself is correct I think.

@casey
Copy link
Owner

casey commented Aug 29, 2024

Hmm, interesting. Can you try with an older version of bash? The tests are passing for me on a Debian box with bash 5.1.4.

@strophy
Copy link
Author

strophy commented Aug 31, 2024

It's really difficult to inject packages from older releases of Alpine during the build process unfortunately. I think I'll just add it to the skipped tests with a brief explanation, given that I was able to pass the test successfully by running it manually. We can add it to the (for now) short list of tests that don't work on Alpine for whatever reason, and someone with more skill with abuild can maybe resolve them one day:

	cargo test --frozen -- \
		--skip choose::default \
		--skip edit::editor_precedence \
		--skip functions::env_var_functions \
                --skip completions::bash

Is that ok with you, should I go ahead and open a MR and see what the Alpine maintainers think about it?

@casey
Copy link
Owner

casey commented Aug 31, 2024

That sounds pretty reasonable to me! I think this is something going on with Alpine, since tests are passing on other Linux distros, so there's probably not much to do on the just side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants