-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
nixosTests.nixos-test-driver: init #157161
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
Open
Synthetica9
wants to merge
10
commits into
NixOS:master
Choose a base branch
from
Synthetica9:test-driver-tests-minimal
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
b827052
circom: init at 2.1.6
RaitoBezarius a6ef95c
nixos/test-driver: add and export Driver.must_raise
Synthetica9 8db1cf9
nixos/test-driver: remove magic number for timeout
Synthetica9 145c792
nixos/test-driver: add timeout to wait_for_file
Synthetica9 353fe22
nixos/test-driver: add timeout to wait_until_tty_matches
Synthetica9 ff9be01
nixos/test-driver: add timeout to wait_for_text
Synthetica9 d69c798
nixos/test-driver: add timeout to wait_for_window
Synthetica9 773ef36
nixosTests.nixos-test-driver: init
Synthetica9 ede6179
nixos/lib/test-driver: passthru driver specific tests
RaitoBezarius 4e8bd51
nixos/lib/test-driver: ruff-ify the driver.py
RaitoBezarius File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| [paths] | ||
| source = | ||
| ./test_driver/ | ||
| /build/test_driver/ | ||
| **/site-packages/test_driver/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| .mutmut-cache | ||
| .coverage | ||
| coverage.xml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| def pre_mutation(context): | ||
| line = context.current_source_line.strip() | ||
| if line.startswith("self.log") or line.startswith("raise") or ".nested" in line: | ||
| context.skip = True |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| #! /usr/bin/env nix-shell | ||
| #! nix-shell -I nixpkgs=../../.. -p black mutmut python3Packages.coverage -i bash | ||
|
|
||
| set -euxo pipefail | ||
|
|
||
| coverage combine --keep $(nix-build ../../.. -A nixosTests.nixos-test-driver) | ||
|
|
||
| mutmut run \ | ||
| --runner "nix build -f ../../.. nixosTests.nixos-test-driver" \ | ||
| --paths-to-mutate "./test_driver/machine.py" \ | ||
| --use-coverage \ | ||
| --post-mutation "black test_driver -q" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| from subprocess import check_call | ||
| from contextlib import contextmanager | ||
| from pathlib import Path | ||
|
|
||
| exampleDir = Path("/tmp/exampleDir") | ||
| exampleDir.mkdir(parents=True, exist_ok=True) | ||
|
|
||
| exampleFile = exampleDir / "exampleFile" | ||
| exampleFile.write_bytes(bytes(range(256))) | ||
| assert exampleFile.exists() | ||
|
|
||
|
|
||
| def host_files_same(path1, path2): | ||
| return check_call(["diff", path1, path2]) | ||
|
|
||
|
|
||
| @contextmanager | ||
| def no_sleep(): | ||
| import time | ||
|
|
||
| old_sleep = time.sleep | ||
| time.sleep = lambda x: None | ||
| yield | ||
| time.sleep = old_sleep | ||
|
|
||
|
|
||
| out = Path(os.environ.get("out", ".")).resolve() | ||
|
|
||
| start_all() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| pkgs: driver: | ||
| let | ||
| coverage-rc = pkgs.writeText "coverage.rc" '' | ||
| [run] | ||
| include = | ||
| **/site-packages/test_driver/* | ||
| ''; | ||
|
|
||
| coverage = "${pkgs.python3Packages.coverage}/bin/coverage"; | ||
|
|
||
| pythonButItsCoverage = pkgs.writeScript "python-coverage" '' | ||
| #!${pkgs.runtimeShell} | ||
| set -euxo pipefail | ||
| COVERAGE_RCFILE=${coverage-rc} ${coverage} run -- "$@" | ||
| RETURN_CODE=$? | ||
|
|
||
| if whoami | grep "nixbld"; then | ||
|
||
| cp .coverage $out | ||
| fi | ||
|
|
||
| exit $RETURN_CODE | ||
| ''; | ||
|
|
||
| coverageDriver = pkgs.runCommand "test-driver-coverage" { } '' | ||
| mkdir -p $out/bin | ||
| cat \ | ||
| <(echo "#!${pythonButItsCoverage}") \ | ||
| ${driver}/bin/.nixos-test-driver-wrapped \ | ||
| > $out/bin/.nixos-test-driver-wrapped | ||
| sed "s@${driver}@$out@" ${driver}/bin/nixos-test-driver > $out/bin/nixos-test-driver | ||
| chmod +x $out/bin/nixos-test-driver | ||
| chmod +x $out/bin/.nixos-test-driver-wrapped | ||
| # exit 1 | ||
|
||
| ''; | ||
| in | ||
| pkgs.symlinkJoin { | ||
| name = "${driver.name}-coverage"; | ||
| paths = [ coverageDriver driver ]; | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking:
(Resuming thread #157161 (comment))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, why not, actually.