Skip to content

scarab: Add test#345209

Draft
l0b0 wants to merge 1 commit intoNixOS:masterfrom
l0b0:scarab-test
Draft

scarab: Add test#345209
l0b0 wants to merge 1 commit intoNixOS:masterfrom
l0b0:scarab-test

Conversation

@l0b0
Copy link
Contributor

@l0b0 l0b0 commented Sep 29, 2024

Description of changes

Simple verification that Scarab runs at all, to avoid regressions like #345038.

Depends on fifty-six/Scarab#241.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@github-actions github-actions bot added the 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS label Sep 29, 2024
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. labels Sep 29, 2024
@huantianad
Copy link
Contributor

ngl I'm not too familiar with nix test conventions haha, I'll check later more

Are we now sorting arguments alphabetically? I thought we sorted them by first usage... I have no idea where this convention is defined though.

We should probably set

projectFile = "Scarab/Scarab.csproj";
testProjectFile = "Scarab.Tests/Scarab.Tests.csproj";

to stop including the unit tests in the release build and also set

doCheck = true;

to actually run the unit tests, in a separate commit.

@wegank wegank added the 2.status: merge conflict This PR has merge conflicts with the target branch label Nov 1, 2024
@l0b0 l0b0 marked this pull request as ready for review March 8, 2025 14:29
@ofborg ofborg bot removed the 2.status: merge conflict This PR has merge conflicts with the target branch label Mar 8, 2025
Copy link
Member

@mweinelt mweinelt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's overkill. You'll want testers.testVersion instead.

@l0b0
Copy link
Contributor Author

l0b0 commented Mar 8, 2025

That's overkill. You'll want testers.testVersion instead.

Good idea! But I can't get tests.version = testers.testVersion { package = scarab; command = "Scarab --version";}; to work:

❯ nix-build -A scarab.tests
this derivation will be built:
  /nix/store/s8k6idm2naikpzrs0nb3msls0j2bzjsd-scarab-2.6.0.0-test-version.drv
building '/nix/store/s8k6idm2naikpzrs0nb3msls0j2bzjsd-scarab-2.6.0.0-test-version.drv'...
Scarab --version returned a non-zero exit code.
Unhandled exception. System.UnauthorizedAccessException: Access to the path '/homeless-shelter' is denied.
 ---> System.IO.IOException: Permission denied
   --- End of inner exception stack trace ---
   at System.IO.FileSystem.CreateParentsAndDirectory(String fullPath, UnixFileMode unixCreateMode)
   at System.IO.FileSystem.CreateDirectory(String fullPath, UnixFileMode unixCreateMode)
   at System.IO.Directory.CreateDirectory(String path)
   at System.Environment.GetFolderPathCore(SpecialFolder folder, SpecialFolderOption option)
   at System.Environment.GetFolderPath(SpecialFolder folder, SpecialFolderOption option)
   at Scarab.Settings.get_ConfigPath() in /build/source/Scarab/Settings.cs:line 53
   at Scarab.Settings.GetOrCreateDirPath() in /build/source/Scarab/Settings.cs:line 71
   at Scarab.Program.SetupLogging() in /build/source/Scarab/Program.cs:line 55
   at Scarab.Program.Main(String[] args) in /build/source/Scarab/Program.cs:line 20
error: builder for '/nix/store/s8k6idm2naikpzrs0nb3msls0j2bzjsd-scarab-2.6.0.0-test-version.drv' failed with exit code 1;

What gives?

@l0b0 l0b0 requested review from drupol and mweinelt March 8, 2025 15:13
@mweinelt
Copy link
Member

mweinelt commented Mar 8, 2025

We are not going to boot up a VM to run the version test for a program.

Unhandled exception. System.UnauthorizedAccessException: Access to the path '/homeless-shelter' is denied.

This means HOME needs to be set in testVersion. Or you just use pkgs.runCommand directly.

@github-actions github-actions bot removed the 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS label Mar 8, 2025
@l0b0
Copy link
Contributor Author

l0b0 commented Mar 8, 2025

Unhandled exception. System.UnauthorizedAccessException: Access to the path '/homeless-shelter' is denied.

This means HOME needs to be set in testVersion. Or you just use pkgs.runCommand directly.

Thanks for the info; this sort of thing is not obvious ! I've asked upstream if they can patch to allow the program to print the version number without attempting to use a graphical environment.

@drupol
Copy link
Contributor

drupol commented Mar 8, 2025

You can perhaps use the new hook tmpDirAsHomeHook for the test phase ?

@drupol
Copy link
Contributor

drupol commented Mar 8, 2025

Some inspiration here: #378110

@l0b0
Copy link
Contributor Author

l0b0 commented Mar 8, 2025

You can perhaps use the new hook tmpDirAsHomeHook for the test phase ?

Thank you, but the bigger problem is that Scarab --version tries to run GUI code. I'll just put this on hold until that's fixed upstream.

@l0b0 l0b0 marked this pull request as draft March 8, 2025 15:57
@drupol
Copy link
Contributor

drupol commented Jun 26, 2025

What's the status of this ?

@l0b0
Copy link
Contributor Author

l0b0 commented Jun 26, 2025

What's the status of this ?

fifty-six/Scarab#241 (comment)

@nixpkgs-ci nixpkgs-ci bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Dec 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants