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

Add powertest rule #959

Merged
merged 3 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ It is strongly recommended that you install Nix for hacking on eza. We leverage
nix as a way to easily test and distribute eza to many users, and it allows us
to provide multiple tools easily for developers. Instead of having to install
each dependency manually and setting up a development environment, Nix allows
you to use the same environment as the devs use.
you to use the same environment as the devs use.

Therefore, it is useful that you have a version of Nix installed with the
"experimental" feature flakes enabled. Further, to make hacking on eza as easy
Expand Down Expand Up @@ -66,21 +66,24 @@ directory.

eza depends on [libgit2](https://github.com/rust-lang/git2-rs) for certain
features. If you’re unable to compile libgit2, you can opt out of Git support
by running `cargo build --no-default-features`. Again, the nix flake should
by running `cargo build --no-default-features`. Again, the nix flake should
have taken care of this for you, if not, please file an issue.

If you intend to compile for musl, you will need to use the flag
`vendored-openssl` if you want to get the Git feature working. The full command
is `cargo build --release --target=x86_64-unknown-linux-musl --features
vendored-openssl,git`.

If you want more information on the tests please read:
[testing on eza](https://github.com/eza-community/eza/blob/main/TESTING.md)

## Creating a PR

First, use the pull request template.

Please make sure that the thing you worked on... actually works. Make sure to
also add how you ensured this in the PR description. Further, it's expected
that you do your best to check for regressions.
that you do your best to check for regressions.

If your PR introduces a flag, you MUST:
- Add completions for bash, zsh, fish, nushell
Expand Down
34 changes: 34 additions & 0 deletions TESTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<!--
SPDX-FileCopyrightText: 2024 Christina Sørensen, Martin Fillon
SPDX-FileContributor: Christina Sørensen

SPDX-License-Identifier: EUPL-1.2
-->
# Testing eza

## Running tests

In order to run the tests in eza you need:
- [just](https://github.com/casey/just)
- [nix](https://nixos.org)

then either run:
- `just itest`
- `nix build -L trycmd-local`

## Modifying tests

In order to test your changes on eza, you will need to do one or multiple things in different cases.
You will need the additional tool
- [powertest](https://github.com/eza-community/powertest)

You will also need to modify the `devtools/dir-generator.sh` file if you want to add some test cases

### You added/modified an option

Please run `just regen` to regenerate powertesting. Then look into `tests/gen` or `tests/cmd` for any tests not passing

### You changed the output of eza

Please run `nix build -L trydump` or `just idump`
And lookout for any test no longer passing
16 changes: 15 additions & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ gen_test_dir:
rm ./tests/gen/*_nix.stdout -f || echo
rm ./tests/gen/*_unix.stderr -f || echo
rm ./tests/gen/*_unix.stdout -f || echo
rm ./tests/ptests/ptest_*.stderr -f || echo
rm ./tests/ptests/ptest_*.stderr -f || echo
rm ./tests/ptests/ptest_*.stdout -f || echo

nix build -L ./#trydump
Expand All @@ -275,3 +275,17 @@ gen_test_dir:

@itest-gen:
nix build -L ./#trycmd

# Fully re-generates the integration tests using powertest

@regen:
which powertest >&- 2>&- || (echo -e "Powertest not installed. Please Clone the repo and run:\n\tcargo install --path . --locked" && exit 1)
echo "WARNING: this will delete all tests in tests/ptest"
sleep 5
echo "Deleting tests/ptests"
rm -rf tests/ptests
echo "Generating tests/ptests"
powertest
nix build -L ./#trydump
find result/dump -type f \( -name "*.stdout" -o -name "*.stderr" \) -exec sh -c 'base=$(basename {}); if [ -e "tests/ptests/${base%.*}.toml" ]; then cp {} tests/ptests/; fi' \;

10 changes: 5 additions & 5 deletions tests/ptests/ptest_10c50228fc1c6107.stdout
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
drwxr-xr-x - nixbld 1 Jan 1970 specials
drwxr-xr-x - nixbld 1 Jan 1970 symlinks
drwxr-xr-x - nixbld 1 Jan 1970 time
drwxr-xr-x - nixbld 1 Jan 1970 perms
drwxr-xr-x - nixbld 1 Jan 1970 size
drwxr-xr-x - nixbld 1 Jan 1970 group
drwxr-xr-x - nixbld 1 Jan 1970 icons
drwxr-xr-x - nixbld 1 Jan 1970 time
drwxr-xr-x - nixbld 1 Jan 1970 symlinks
drwxr-xr-x - nixbld 1 Jan 1970 grid
drwxr-xr-x - nixbld 1 Jan 1970 perms
drwxr-xr-x - nixbld 1 Jan 1970 group
drwxr-xr-x - nixbld 1 Jan 1970 specials
drwxr-xr-x - nixbld 1 Jan 1970 git
10 changes: 5 additions & 5 deletions tests/ptests/ptest_132ac9f159c3473e.stdout
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
drwxr-xr-x - nixbld 1 Jan 1970 specials
drwxr-xr-x - nixbld 1 Jan 1970 symlinks
drwxr-xr-x - nixbld 1 Jan 1970 time
drwxr-xr-x - nixbld 1 Jan 1970 perms
drwxr-xr-x - nixbld 1 Jan 1970 size
drwxr-xr-x - nixbld 1 Jan 1970 group
drwxr-xr-x - nixbld 1 Jan 1970 icons
drwxr-xr-x - nixbld 1 Jan 1970 time
drwxr-xr-x - nixbld 1 Jan 1970 symlinks
drwxr-xr-x - nixbld 1 Jan 1970 grid
drwxr-xr-x - nixbld 1 Jan 1970 perms
drwxr-xr-x - nixbld 1 Jan 1970 group
drwxr-xr-x - nixbld 1 Jan 1970 specials
drwxr-xr-x - nixbld 1 Jan 1970 git
2 changes: 0 additions & 2 deletions tests/ptests/ptest_1a3b7e2197b9241c.toml

This file was deleted.

10 changes: 5 additions & 5 deletions tests/ptests/ptest_1ab8279d631495b0.stdout
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
drwxr-xr-x - nixbld 1 Jan 1970 specials
drwxr-xr-x - nixbld 1 Jan 1970 symlinks
drwxr-xr-x - nixbld 1 Jan 1970 time
drwxr-xr-x - nixbld 1 Jan 1970 perms
drwxr-xr-x - nixbld 1 Jan 1970 size
drwxr-xr-x - nixbld 1 Jan 1970 group
drwxr-xr-x - nixbld 1 Jan 1970 icons
drwxr-xr-x - nixbld 1 Jan 1970 time
drwxr-xr-x - nixbld 1 Jan 1970 symlinks
drwxr-xr-x - nixbld 1 Jan 1970 grid
drwxr-xr-x - nixbld 1 Jan 1970 perms
drwxr-xr-x - nixbld 1 Jan 1970 group
drwxr-xr-x - nixbld 1 Jan 1970 specials
drwxr-xr-x - nixbld 1 Jan 1970 git
10 changes: 5 additions & 5 deletions tests/ptests/ptest_1e61d8c305ff6c48.stdout
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
drwxr-xr-x - nixbld 1 Jan 1970 specials
drwxr-xr-x - nixbld 1 Jan 1970 symlinks
drwxr-xr-x - nixbld 1 Jan 1970 time
drwxr-xr-x - nixbld 1 Jan 1970 perms
drwxr-xr-x - nixbld 1 Jan 1970 size
drwxr-xr-x - nixbld 1 Jan 1970 group
drwxr-xr-x - nixbld 1 Jan 1970 icons
drwxr-xr-x - nixbld 1 Jan 1970 time
drwxr-xr-x - nixbld 1 Jan 1970 symlinks
drwxr-xr-x - nixbld 1 Jan 1970 grid
drwxr-xr-x - nixbld 1 Jan 1970 perms
drwxr-xr-x - nixbld 1 Jan 1970 group
drwxr-xr-x - nixbld 1 Jan 1970 specials
drwxr-xr-x - nixbld 1 Jan 1970 git
9 changes: 9 additions & 0 deletions tests/ptests/ptest_219f7c8dfa0d0323.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
git/
grid/
group/
icons/
perms/
size/
specials/
symlinks/
time/
2 changes: 0 additions & 2 deletions tests/ptests/ptest_2d55f5cf8a903fda.toml

This file was deleted.

2 changes: 0 additions & 2 deletions tests/ptests/ptest_339353fd84c1145e.toml

This file was deleted.

10 changes: 5 additions & 5 deletions tests/ptests/ptest_469e79a86c2c874f.stdout
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
drwxr-xr-x - nixbld 1 Jan 1970 specials
drwxr-xr-x - nixbld 1 Jan 1970 symlinks
drwxr-xr-x - nixbld 1 Jan 1970 time
drwxr-xr-x - nixbld 1 Jan 1970 perms
drwxr-xr-x - nixbld 1 Jan 1970 size
drwxr-xr-x - nixbld 1 Jan 1970 group
drwxr-xr-x - nixbld 1 Jan 1970 icons
drwxr-xr-x - nixbld 1 Jan 1970 time
drwxr-xr-x - nixbld 1 Jan 1970 symlinks
drwxr-xr-x - nixbld 1 Jan 1970 grid
drwxr-xr-x - nixbld 1 Jan 1970 perms
drwxr-xr-x - nixbld 1 Jan 1970 group
drwxr-xr-x - nixbld 1 Jan 1970 specials
drwxr-xr-x - nixbld 1 Jan 1970 git
2 changes: 0 additions & 2 deletions tests/ptests/ptest_5a8530dc7b091286.toml

This file was deleted.

10 changes: 5 additions & 5 deletions tests/ptests/ptest_6e6893c2c2254622.stdout
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
drwxr-xr-x - nixbld 1 Jan 1970 specials
drwxr-xr-x - nixbld 1 Jan 1970 symlinks
drwxr-xr-x - nixbld 1 Jan 1970 time
drwxr-xr-x - nixbld 1 Jan 1970 perms
drwxr-xr-x - nixbld 1 Jan 1970 size
drwxr-xr-x - nixbld 1 Jan 1970 group
drwxr-xr-x - nixbld 1 Jan 1970 icons
drwxr-xr-x - nixbld 1 Jan 1970 time
drwxr-xr-x - nixbld 1 Jan 1970 symlinks
drwxr-xr-x - nixbld 1 Jan 1970 grid
drwxr-xr-x - nixbld 1 Jan 1970 perms
drwxr-xr-x - nixbld 1 Jan 1970 group
drwxr-xr-x - nixbld 1 Jan 1970 specials
drwxr-xr-x - nixbld 1 Jan 1970 git
10 changes: 5 additions & 5 deletions tests/ptests/ptest_7d1cd636566df8cd.stdout
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
drwxr-xr-x - nixbld 1 Jan 1970 specials
drwxr-xr-x - nixbld 1 Jan 1970 symlinks
drwxr-xr-x - nixbld 1 Jan 1970 time
drwxr-xr-x - nixbld 1 Jan 1970 perms
drwxr-xr-x - nixbld 1 Jan 1970 size
drwxr-xr-x - nixbld 1 Jan 1970 group
drwxr-xr-x - nixbld 1 Jan 1970 icons
drwxr-xr-x - nixbld 1 Jan 1970 time
drwxr-xr-x - nixbld 1 Jan 1970 symlinks
drwxr-xr-x - nixbld 1 Jan 1970 grid
drwxr-xr-x - nixbld 1 Jan 1970 perms
drwxr-xr-x - nixbld 1 Jan 1970 group
drwxr-xr-x - nixbld 1 Jan 1970 specials
drwxr-xr-x - nixbld 1 Jan 1970 git
9 changes: 9 additions & 0 deletions tests/ptests/ptest_80cd40f7a3947055.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
git/
grid/
group/
icons/
perms/
size/
specials/
symlinks/
time/
10 changes: 5 additions & 5 deletions tests/ptests/ptest_825e60e73630f857.stdout
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
drwxr-xr-x - nixbld 1 Jan 1970 specials
drwxr-xr-x - nixbld 1 Jan 1970 symlinks
drwxr-xr-x - nixbld 1 Jan 1970 time
drwxr-xr-x - nixbld 1 Jan 1970 perms
drwxr-xr-x - nixbld 1 Jan 1970 size
drwxr-xr-x - nixbld 1 Jan 1970 group
drwxr-xr-x - nixbld 1 Jan 1970 icons
drwxr-xr-x - nixbld 1 Jan 1970 time
drwxr-xr-x - nixbld 1 Jan 1970 symlinks
drwxr-xr-x - nixbld 1 Jan 1970 grid
drwxr-xr-x - nixbld 1 Jan 1970 perms
drwxr-xr-x - nixbld 1 Jan 1970 group
drwxr-xr-x - nixbld 1 Jan 1970 specials
drwxr-xr-x - nixbld 1 Jan 1970 git
9 changes: 0 additions & 9 deletions tests/ptests/ptest_8484317bd3add4dc.stdout

This file was deleted.

2 changes: 0 additions & 2 deletions tests/ptests/ptest_8484317bd3add4dc.toml

This file was deleted.

10 changes: 5 additions & 5 deletions tests/ptests/ptest_8becd3030ba5621c.stdout
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
drwxr-xr-x - nixbld 1 Jan 1970 specials
drwxr-xr-x - nixbld 1 Jan 1970 symlinks
drwxr-xr-x - nixbld 1 Jan 1970 time
drwxr-xr-x - nixbld 1 Jan 1970 perms
drwxr-xr-x - nixbld 1 Jan 1970 size
drwxr-xr-x - nixbld 1 Jan 1970 group
drwxr-xr-x - nixbld 1 Jan 1970 icons
drwxr-xr-x - nixbld 1 Jan 1970 time
drwxr-xr-x - nixbld 1 Jan 1970 symlinks
drwxr-xr-x - nixbld 1 Jan 1970 grid
drwxr-xr-x - nixbld 1 Jan 1970 perms
drwxr-xr-x - nixbld 1 Jan 1970 group
drwxr-xr-x - nixbld 1 Jan 1970 specials
drwxr-xr-x - nixbld 1 Jan 1970 git
10 changes: 5 additions & 5 deletions tests/ptests/ptest_8cd9b0ae2930d704.stdout
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
drwxr-xr-x - nixbld 1 Jan 1970 time
drwxr-xr-x - nixbld 1 Jan 1970 specials
drwxr-xr-x - nixbld 1 Jan 1970 perms
drwxr-xr-x - nixbld 1 Jan 1970 symlinks
drwxr-xr-x - nixbld 1 Jan 1970 group
drwxr-xr-x - nixbld 1 Jan 1970 icons
drwxr-xr-x - nixbld 1 Jan 1970 grid
drwxr-xr-x - nixbld 1 Jan 1970 git
drwxr-xr-x - nixbld 1 Jan 1970 specials
drwxr-xr-x - nixbld 1 Jan 1970 size
drwxr-xr-x - nixbld 1 Jan 1970 icons
drwxr-xr-x - nixbld 1 Jan 1970 perms
drwxr-xr-x - nixbld 1 Jan 1970 group
drwxr-xr-x - nixbld 1 Jan 1970 time
9 changes: 0 additions & 9 deletions tests/ptests/ptest_8d1d7d130b125e45.stdout

This file was deleted.

2 changes: 0 additions & 2 deletions tests/ptests/ptest_8d1d7d130b125e45.toml

This file was deleted.

9 changes: 0 additions & 9 deletions tests/ptests/ptest_8da0d5649bbd84c6.stdout

This file was deleted.

2 changes: 0 additions & 2 deletions tests/ptests/ptest_8da0d5649bbd84c6.toml

This file was deleted.

9 changes: 0 additions & 9 deletions tests/ptests/ptest_8ece6263396deeab.stdout

This file was deleted.

2 changes: 0 additions & 2 deletions tests/ptests/ptest_8ece6263396deeab.toml

This file was deleted.

Empty file.
9 changes: 0 additions & 9 deletions tests/ptests/ptest_9ae275067dcd14d7.stdout

This file was deleted.

2 changes: 0 additions & 2 deletions tests/ptests/ptest_9ae275067dcd14d7.toml

This file was deleted.

3 changes: 3 additions & 0 deletions tests/ptests/ptest_a82ad7ec2e961f84.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
eza - A modern, maintained replacement for ls
v0.19.4 [+git] (pre-release debug build!)
https://github.com/eza-community/eza
10 changes: 5 additions & 5 deletions tests/ptests/ptest_abc83ec759ddab6.stdout
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
drwxr-xr-x - nixbld 1 Jan 1970 specials
drwxr-xr-x - nixbld 1 Jan 1970 symlinks
drwxr-xr-x - nixbld 1 Jan 1970 time
drwxr-xr-x - nixbld 1 Jan 1970 perms
drwxr-xr-x - nixbld 1 Jan 1970 size
drwxr-xr-x - nixbld 1 Jan 1970 group
drwxr-xr-x - nixbld 1 Jan 1970 icons
drwxr-xr-x - nixbld 1 Jan 1970 time
drwxr-xr-x - nixbld 1 Jan 1970 symlinks
drwxr-xr-x - nixbld 1 Jan 1970 grid
drwxr-xr-x - nixbld 1 Jan 1970 perms
drwxr-xr-x - nixbld 1 Jan 1970 group
drwxr-xr-x - nixbld 1 Jan 1970 specials
drwxr-xr-x - nixbld 1 Jan 1970 git
Empty file.
9 changes: 0 additions & 9 deletions tests/ptests/ptest_ad68b42d7025e272.stdout

This file was deleted.

2 changes: 0 additions & 2 deletions tests/ptests/ptest_ad68b42d7025e272.toml

This file was deleted.

3 changes: 3 additions & 0 deletions tests/ptests/ptest_af29d370729835d8.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
eza - A modern, maintained replacement for ls
v0.19.4 [+git] (pre-release debug build!)
https://github.com/eza-community/eza
Empty file.
9 changes: 0 additions & 9 deletions tests/ptests/ptest_b2dcd61d44fb5b07.stdout

This file was deleted.

2 changes: 0 additions & 2 deletions tests/ptests/ptest_b2dcd61d44fb5b07.toml

This file was deleted.

Loading