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

test-driver.py: fix VM state directory deletion #97346

Merged
merged 1 commit into from Sep 10, 2020

Conversation

@NinjaTrappeur
Copy link
Member

@NinjaTrappeur NinjaTrappeur commented Sep 7, 2020

Motivation for this change

The previous version of the code would only kick in if the state
directory path pointed at a file, which never occurs.

Making that
codepath actually work reveals an ordering bug, which this patch fixes
as well.

Bug report:
#91046 (comment)

Things done

Fix this bug.

It also replaces the confusing, imperative case log message "delete VM
state directory" with "deleting VM state directory".

Finally, we hint the user about how to prevent this deletion. IE. by
passing the --keep-vm-state flag.

Credit goes to Edef for the rebase on top of a recent nixpkgs commit
and for writing most of this commit message.

  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
The previous version of the code would only kick in if the state
directory path pointed at a *file*, which never occurs. Making that
codepath actually work reveals an ordering bug, which this patch fixes
as well.

It also replaces the confusing, imperative case log message "delete VM
state directory" with "deleting VM state directory".

Finally, we hint the user about how to prevent this deletion. IE. by
passing the --keep-vm-state flag.

Bug report:
#91046 (comment)

Credit goes to Edef for the rebase on top of a recent nixpkgs commit
and for writing most of this commit message.

Co-authored-by: edef <edef@edef.eu>
@Ma27
Ma27 approved these changes Sep 8, 2020
@flokli
flokli approved these changes Sep 10, 2020
@flokli flokli merged commit ee55841 into NixOS:master Sep 10, 2020
17 checks passed
17 checks passed
tests tests
Details
action
Details
Evaluation Performance Report Evaluator Performance Report
Details
Wait for ofborg
Details
grahamcofborg-eval ^.^!
Details
grahamcofborg-eval-check-maintainers matching changed paths to changed attrs...
Details
grahamcofborg-eval-check-meta config.nix: checkMeta = true
Details
grahamcofborg-eval-darwin nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ecb73fd"; rev="ecb73fd5557d6d438aa7c155e5b1aad89373c6ae"; } ./pkgs/t
Details
grahamcofborg-eval-lib-tests nix-build --arg pkgs import ./. {} ./lib/tests/release.nix
Details
grahamcofborg-eval-nixos nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ecb73fd"; rev="ecb73fd5557d6d438aa7c155e5b1aad89373c6ae"; } ./nixos/
Details
grahamcofborg-eval-nixos-manual nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ecb73fd"; rev="ecb73fd5557d6d438aa7c155e5b1aad89373c6ae"; } ./nixos/
Details
grahamcofborg-eval-nixos-options nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ecb73fd"; rev="ecb73fd5557d6d438aa7c155e5b1aad89373c6ae"; } ./nixos/
Details
grahamcofborg-eval-nixpkgs-manual nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ecb73fd"; rev="ecb73fd5557d6d438aa7c155e5b1aad89373c6ae"; } ./pkgs/t
Details
grahamcofborg-eval-nixpkgs-tarball nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ecb73fd"; rev="ecb73fd5557d6d438aa7c155e5b1aad89373c6ae"; } ./pkgs/t
Details
grahamcofborg-eval-nixpkgs-unstable-jobset nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ecb73fd"; rev="ecb73fd5557d6d438aa7c155e5b1aad89373c6ae"; } ./pkgs/t
Details
grahamcofborg-eval-package-list nix-env -qa --json --file .
Details
grahamcofborg-eval-package-list-no-aliases nix-env -qa --json --file . --arg config { allowAliases = false; }
Details
@flokli
Copy link
Contributor

@flokli flokli commented Sep 10, 2020

Backported to 20.09 in 5500dc8.

@vcunat
Copy link
Member

@vcunat vcunat commented Sep 11, 2020

This merge breaks some basic tests (I checked a local revert). Unless we have a fix very soon (say, today), I suggest to revert it until the issue is resolved.

I'm starting to get annoyed that I now have to revert channel blockers on a daily basis.

NinjaTrappeur added a commit to NinjaTrappeur/nixpkgs that referenced this pull request Sep 11, 2020
ecb73fd introduced a new keepVmState
CLI flag for test-driver.py. This CLI flags gets forwarded to the
Machine class through create_machine.

It created a regression for the boot tests where __main__ end up not
being evaluated. See
NixOS#97346 (comment) for
bug report.

Defaulting keepVmState to false when __main__ ends up not being
evaluated.
@NinjaTrappeur
Copy link
Member Author

@NinjaTrappeur NinjaTrappeur commented Sep 11, 2020

Errrr, I did not know this script could be evaluated from outside of __main__, my bad.

See #97746 for a one liner fix.

@NinjaTrappeur NinjaTrappeur deleted the NinjaTrappeur:nin-fix-vm-rm-state branch Sep 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.