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

intel-media-sdk: remove samples #89223

Merged
merged 2 commits into from May 31, 2020
Merged

Conversation

midchildan
Copy link
Member

Motivation for this change

Fix #88939. Also enable unit tests.

Things done
  • 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.

}:
{ stdenv, fetchurl, cmake, pkgconfig, gtest, libdrm, libpciaccess, libva
, libX11 , libXau, libXdmcp, libpthreadstubs
, doCheck ? true }:
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think the doCheck switch is even necessary. If someone will want to disable tests they'll always be able to use overrideAttrs.

Copy link
Member Author

Choose a reason for hiding this comment

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

doCheck is necessary so that I can tell cmake to not build the tests if it's false. Otherwise, the build would fail because dependencies from checkInputs would be ignored in this situation.

To ensure consistent behavior while allowing the builds to succeed, I have changed doCheck to respect the value of config.doCheckByDefault.

Copy link
Contributor

Choose a reason for hiding this comment

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

From my experience, checkInputs don't even enter the environment if doCheck is not true.

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

https://github.com/NixOS/nixpkgs/pull/89223/files#diff-b6364e583825dc39777b37eb0c055a50R22

I saw that commit. I'm just not sure I totally understand this:

doCheck is necessary so that I can tell cmake to not build the tests if it's false.

I claim, that with doCheck set to true unconditionally, and someone wishing to set it to false with an overrideAttrs, the tests won't even be built because gtest is in checkInputs (vs nativeBuildInputs). Meaning, that it's not needed to put this switch in the top level arguments - for all purposes, overrideAttrs setting doCheck to false will be enough.

Copy link
Member Author

Choose a reason for hiding this comment

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

I wasn't aware of config.doCheckByDefault until today. If there is a configuration, I think it's best to respect it.

Copy link
Contributor

Choose a reason for hiding this comment

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

With all due respect to user configs, my personal opinion is that checks should be enabled by default where they don't fail - it helps detecting issues in updates by @r-ryantm where one may feel lazy to try to catch any by actually using the package they updated, especially if it's a library. I think also that committers like checks to be run if they are available and they don't fail. That's why it is enabled by default in the Python's ecosystem and they've even went as far as requesting contributors to add import tests if no tests are available by upstream ( pythonImportsCheck).

I once added a superficial check for a package I maintain at: https://github.com/NixOS/nixpkgs/pull/87734/files so that I'd be able to spare my self the need to check it myself upon updates.

But anyway, that's your choice. Let's hope your PR will even get any attention as it seems like hard times lately with the amount of time committers have to put into Nixpkgs :).

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not really sure about the purpose of config.doCheckByDefault, so I'm fine with ignoring it if it's not meant for strict enforcement. But I'd like to hear from committers before I actually do anything further.

Copy link
Contributor

Choose a reason for hiding this comment

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

If there's not a specific reason not to, derivations should always run unit tests, as it facilitates spotting errors during version bumps. When someone wants to bump the package, and tests suddenly fail, most likely getting the tests back to work requires editing the derivation anyhow, so we should just set doCheck = true; here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, I have now set doCheck = true back again.

@@ -11,12 +11,19 @@ stdenv.mkDerivation rec {
sha256 = "1p13b4abslq31pbgqf0bzs2ixns85yfdsm94326h2vcg0q7hqc24";
};

# patchelf is needed for binaries in $out/share/samples
nativeBuildInputs = [ autoPatchelfHook cmake pkgconfig ];
nativeBuildInputs = [ cmake pkgconfig gtest ];
Copy link
Contributor

Choose a reason for hiding this comment

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

On the other hand, I'd put gtest in checkInputs.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done


cmakeFlags = [
"-DBUILD_SAMPLES=OFF"
"-DBUILD_TESTS=${if doCheck then "ON" else "OFF"}"
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm up to keeping this line on the other hand.

@doronbehar
Copy link
Contributor

@GrahamcOfBorg build ffmpeg-full

Copy link
Contributor

@doronbehar doronbehar left a comment

Choose a reason for hiding this comment

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

Alles goot to me.

@flokli
Copy link
Contributor

flokli commented May 31, 2020

Thanks!

@flokli flokli merged commit 5cad739 into NixOS:master May 31, 2020
@doronbehar
Copy link
Contributor

Thanks to you both!

@midchildan midchildan deleted the cleanup/intel-media-sdk branch June 2, 2020 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

intel-media-sdk references gcc
3 participants