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 check phase to ninja setup hook #50527

Merged
merged 10 commits into from Nov 20, 2018

Conversation

matthewbauer
Copy link
Member

Motivation for this change

Most tests in Ninja packages were not getting run because the default check phase assumes you have a Makefile. This adds a check phase to Ninja's setup-hook to fix this. Here is what I changed:

  • Respect installFlags
  • Automatically add checkPhase (can be disabled with dontUseNinjaCheck
    in the same way as dontUseNinjaBuild and dontUseNinjaInstall). Tests
    are only run when "ninja test" exists.
  • Error in build phase when build.ninja is missing. We don’t have a
    way to fall back to other build methods, so it’s best to be very
    clear when we aren’t able to build with ninja
  • Set -l flag to 1 when enableParallelBuilding is disabled

Intended as an alternative to #50323.

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: glib, ninja

Partial log (click to expand)

strip is /nix/store/j13c9z0z495wxdc97if8z451x53m1j25-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/cayd6cjsjsv745w5xia2kxnvff5jn8lx-glib-2.56.0-dev/lib  /nix/store/cayd6cjsjsv745w5xia2kxnvff5jn8lx-glib-2.56.0-dev/bin
patching script interpreter paths in /nix/store/cayd6cjsjsv745w5xia2kxnvff5jn8lx-glib-2.56.0-dev
/nix/store/cayd6cjsjsv745w5xia2kxnvff5jn8lx-glib-2.56.0-dev/bin/glib-gettextize: interpreter directive changed from " /bin/sh" to "/nix/store/qnp0bgn3icxrwcnnhz4pcjynxbcnxfv9-bash-4.4-p23/bin/sh"
/nix/store/cayd6cjsjsv745w5xia2kxnvff5jn8lx-glib-2.56.0-dev/bin/gdbus-codegen: interpreter directive changed from "/usr/bin/env /nix/store/47rm1s86gm284237b1gkv2kdq37jhb6j-python-2.7.15/bin/python" to "/nix/store/47rm1s86gm284237b1gkv2kdq37jhb6j-python-2.7.15/bin/python"
checking for references to /build/ in /nix/store/cayd6cjsjsv745w5xia2kxnvff5jn8lx-glib-2.56.0-dev...
shrinking RPATHs of ELF executables and libraries in /nix/store/gqk0ml9793dhv648wv25bx67rsjx9fl0-glib-2.56.0-devdoc
strip is /nix/store/j13c9z0z495wxdc97if8z451x53m1j25-binutils-2.30/bin/strip
patching script interpreter paths in /nix/store/gqk0ml9793dhv648wv25bx67rsjx9fl0-glib-2.56.0-devdoc
checking for references to /build/ in /nix/store/gqk0ml9793dhv648wv25bx67rsjx9fl0-glib-2.56.0-devdoc...

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: glib, ninja

Partial log (click to expand)

strip is /nix/store/1jprj383qnzd50vn8qq3a0id6a08a9fi-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/d14iwxq31f52awsh1bqsvlf4m4wqh2by-glib-2.56.0-dev/lib  /nix/store/d14iwxq31f52awsh1bqsvlf4m4wqh2by-glib-2.56.0-dev/bin
patching script interpreter paths in /nix/store/d14iwxq31f52awsh1bqsvlf4m4wqh2by-glib-2.56.0-dev
/nix/store/d14iwxq31f52awsh1bqsvlf4m4wqh2by-glib-2.56.0-dev/bin/glib-gettextize: interpreter directive changed from " /bin/sh" to "/nix/store/vg9477j4nafj505cr9agvgndxys7743x-bash-4.4-p23/bin/sh"
/nix/store/d14iwxq31f52awsh1bqsvlf4m4wqh2by-glib-2.56.0-dev/bin/gdbus-codegen: interpreter directive changed from "/usr/bin/env /nix/store/bvzs2rgp66nk5fgna8ilvln8pa0p0jcn-python-2.7.15/bin/python" to "/nix/store/bvzs2rgp66nk5fgna8ilvln8pa0p0jcn-python-2.7.15/bin/python"
checking for references to /build/ in /nix/store/d14iwxq31f52awsh1bqsvlf4m4wqh2by-glib-2.56.0-dev...
shrinking RPATHs of ELF executables and libraries in /nix/store/c6rmg4ys7lgbq9dmadmf23ghmjn9pl1d-glib-2.56.0-devdoc
strip is /nix/store/1jprj383qnzd50vn8qq3a0id6a08a9fi-binutils-2.30/bin/strip
patching script interpreter paths in /nix/store/c6rmg4ys7lgbq9dmadmf23ghmjn9pl1d-glib-2.56.0-devdoc
checking for references to /build/ in /nix/store/c6rmg4ys7lgbq9dmadmf23ghmjn9pl1d-glib-2.56.0-devdoc...

@GrahamcOfBorg
Copy link

Timed out, unknown build status on x86_64-darwin (full log)

Attempted: glib, ninja

Partial log (click to expand)

cannot build derivation '/nix/store/nhnja8qs96wdi7rcs9ry4ngz64bcg08r-xnu-osx-10.11.6.drv': 8 dependencies couldn't be built
cannot build derivation '/nix/store/a65ml2k3yv1rxjs4i6qdnfpbc3g3syy1-IOKit-osx-10.11.6.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/51ypy2bdwxw87ck5vz4sn4zj6vdly0v7-configd-osx-10.8.5.drv': 8 dependencies couldn't be built
cannot build derivation '/nix/store/08lmrn8y8x55gr99dkilmmqn3r93a040-python-2.7.15.drv': 8 dependencies couldn't be built
cannot build derivation '/nix/store/a8zcr6j44s9fw3l6n6nilfx4i1yaas8d-asciidoc-8.6.9.drv': 3 dependencies couldn't be built
cannot build derivation '/nix/store/hzdz4rg2fsacfc02iv6n9j72fpx40bcn-glib-2.56.0.drv': 6 dependencies couldn't be built
cannot build derivation '/nix/store/cckwidc5lap1xkmgcdj826pa7bhfgcgq-libxml2-2.9.8.drv': 3 dependencies couldn't be built
cannot build derivation '/nix/store/p6hxvdaw0vkkjyfpb0p5ynhz91krgy0x-libxslt-1.1.32.drv': 4 dependencies couldn't be built
cannot build derivation '/nix/store/iv06k5yi180jk4d07l5qsvi9c7q75fhr-ninja-1.8.2.drv': 7 dependencies couldn't be built
error: build of '/nix/store/hzdz4rg2fsacfc02iv6n9j72fpx40bcn-glib-2.56.0.drv', '/nix/store/iv06k5yi180jk4d07l5qsvi9c7q75fhr-ninja-1.8.2.drv' failed

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: glib, ninja

Partial log (click to expand)

installing
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/hlvhnbprimqq6rlzr9s4ylpq8ikbybsq-ninja-1.8.2
shrinking /nix/store/hlvhnbprimqq6rlzr9s4ylpq8ikbybsq-ninja-1.8.2/bin/ninja
strip is /nix/store/1jprj383qnzd50vn8qq3a0id6a08a9fi-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/hlvhnbprimqq6rlzr9s4ylpq8ikbybsq-ninja-1.8.2/bin
patching script interpreter paths in /nix/store/hlvhnbprimqq6rlzr9s4ylpq8ikbybsq-ninja-1.8.2
checking for references to /build/ in /nix/store/hlvhnbprimqq6rlzr9s4ylpq8ikbybsq-ninja-1.8.2...
/nix/store/jglaxw6aghh4rplmv3xxhslhdr3vmmzi-glib-2.56.0-bin
/nix/store/hlvhnbprimqq6rlzr9s4ylpq8ikbybsq-ninja-1.8.2

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: glib, ninja

Partial log (click to expand)

patching script interpreter paths in /nix/store/cayd6cjsjsv745w5xia2kxnvff5jn8lx-glib-2.56.0-dev
/nix/store/cayd6cjsjsv745w5xia2kxnvff5jn8lx-glib-2.56.0-dev/bin/gdbus-codegen: interpreter directive changed from "/usr/bin/env /nix/store/47rm1s86gm284237b1gkv2kdq37jhb6j-python-2.7.15/bin/python" to "/nix/store/47rm1s86gm284237b1gkv2kdq37jhb6j-python-2.7.15/bin/python"
/nix/store/cayd6cjsjsv745w5xia2kxnvff5jn8lx-glib-2.56.0-dev/bin/glib-gettextize: interpreter directive changed from " /bin/sh" to "/nix/store/qnp0bgn3icxrwcnnhz4pcjynxbcnxfv9-bash-4.4-p23/bin/sh"
checking for references to /build/ in /nix/store/cayd6cjsjsv745w5xia2kxnvff5jn8lx-glib-2.56.0-dev...
shrinking RPATHs of ELF executables and libraries in /nix/store/gqk0ml9793dhv648wv25bx67rsjx9fl0-glib-2.56.0-devdoc
strip is /nix/store/j13c9z0z495wxdc97if8z451x53m1j25-binutils-2.30/bin/strip
patching script interpreter paths in /nix/store/gqk0ml9793dhv648wv25bx67rsjx9fl0-glib-2.56.0-devdoc
checking for references to /build/ in /nix/store/gqk0ml9793dhv648wv25bx67rsjx9fl0-glib-2.56.0-devdoc...
/nix/store/pv0s3g4qxqflz2c8jbywdfjlr349jra7-glib-2.56.0-bin
/nix/store/r384i98cn696g968rgaw4gylw545l7sn-ninja-1.8.2

@GrahamcOfBorg
Copy link

Timed out, unknown build status on x86_64-darwin (full log)

Attempted: glib, ninja

Partial log (click to expand)

cannot build derivation '/nix/store/3z43haz23x1kfprq92qpkac270rq84qs-xnu-osx-10.11.6.drv': 8 dependencies couldn't be built
cannot build derivation '/nix/store/nm4i2ygdarqr5p7s8qaryp41xr6szy03-IOKit-osx-10.11.6.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/qjbzpk5ah45ss79piq19z6b1hj5inkwg-configd-osx-10.8.5.drv': 8 dependencies couldn't be built
cannot build derivation '/nix/store/bmxfgrckxrhvjyxxfvsddjj2kxvm9v8a-python-2.7.15.drv': 8 dependencies couldn't be built
cannot build derivation '/nix/store/0bmjh9v19n96cdjgck26nilsqbnmas0i-asciidoc-8.6.9.drv': 3 dependencies couldn't be built
cannot build derivation '/nix/store/ms5rjgpa1hlrp7sdp8bi1y9096i0pjwm-glib-2.56.0.drv': 6 dependencies couldn't be built
cannot build derivation '/nix/store/37mnp68y5xxklji2x2gp0142w057p5jl-libxml2-2.9.8.drv': 3 dependencies couldn't be built
cannot build derivation '/nix/store/4c3s5n99szgm3nm79rzwnvy37q5zjx8j-libxslt-1.1.32.drv': 4 dependencies couldn't be built
cannot build derivation '/nix/store/z7lazzi3gvlmvkygqf4r77jckff5lxhl-ninja-1.8.2.drv': 7 dependencies couldn't be built
error: build of '/nix/store/ms5rjgpa1hlrp7sdp8bi1y9096i0pjwm-glib-2.56.0.drv', '/nix/store/z7lazzi3gvlmvkygqf4r77jckff5lxhl-ninja-1.8.2.drv' failed

$ninjaFlags "${ninjaFlagsArray[@]}" \
$buildFlags "${buildFlagsArray[@]}")
local flagsArray=(
-j$buildCores -l$buildCores
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 there is a practical difference between setting -l to $buildCores and $NIX_BUILD_CORES, but conceptually -l specifies a system-wide limit and should be the same for all builds, whereas different builds can have different build-local limits set with -j.

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 am hoping it has the same behavior as in make? The only difference is it is autodetected when left out in ninja.

Copy link
Contributor

@orivej orivej Nov 18, 2018

Choose a reason for hiding this comment

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

There is no change in behaviour, but there is also no need to change -l$NIX_BUILD_CORES to -l$buildCores. I don't want to see -l1 in the command line because -l should be equal to the total number of busy cores across all concurrent builds; it's value should not be affected by the level of parallelism of a particular build.

pkgs/development/tools/build-managers/ninja/setup-hook.sh Outdated Show resolved Hide resolved
$ninjaFlags "${ninjaFlagsArray[@]}")
local flagsArray=(
$ninjaFlags "${ninjaFlagsArray[@]}"
$installFlags "${installFlagsArray[@]}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Ninja does not have any flags that would be useful with the install target. I'd revert the change to glib/setup-hook.sh and remove this line, as it may break other setup hooks too.

Copy link
Member Author

Choose a reason for hiding this comment

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

You may still have flags that you only want to go to ninja install command, though, right? This seems like the most consistent thing, otherwise there is a question of why buildFlags work with ninja but not installFlags.

Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like no package is using buildFlags with ninja (and the only package using ninjaFlags is otfcc); it seems counterproductive to support installFlags. I'd rather remove buildFlags from ninja flags array, since it is not needed and it is documented as a make flags variable.

Copy link
Member Author

Choose a reason for hiding this comment

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

My opinion here is that we should reuse as much of the generic builder as possible. There are definitely some uses for this (for instance with checkFlags below). I can change the doc to reflect that {build|install|check}Flags passes flags to whatever build system you are using - not just make. As meson & cmake replace autotools, I think it is important we make them just as powerful.

Copy link
Contributor

Choose a reason for hiding this comment

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

checkFlags are not applicable to Ninja: checkTarget(s) covers all use cases that it offers.

}

if [ -z "$dontUseNinjaCheck" -a -z "$checkPhase" ]; then
checkPhase=ninjaCheckPhase
Copy link
Contributor

Choose a reason for hiding this comment

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

How does this interact with meson setup hook? First come in nativeBuildInputs first served?

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 think we'd have to remove the meson check phase to avoid confusion. It would probably be whichever one is set first.

Copy link
Contributor

Choose a reason for hiding this comment

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

Since meson depends on ninja, meson hook will run first and set the checkPhase.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oops, @Ericson2314 was working on it, but currently this is not the case, and the order in nativeBuildInputs is decisive.

@jtojnar
Copy link
Contributor

jtojnar commented Nov 18, 2018

One thing meson test has, it accepts extra arguments. For example, I can filter the tests or wrap them in xvfb-run: http://mesonbuild.com/Unit-tests.html#testing-tool

@matthewbauer
Copy link
Member Author

@jtojnar That is definitely a disadvantage of doing make check. But, I believe ninja test will pass these correctly. Ideally you should just have to pass them in as checkFlags = "...";.

@orivej
Copy link
Contributor

orivej commented Nov 19, 2018

Ninja does not have flags, it has only targets.

@GrahamcOfBorg GrahamcOfBorg added the 6.topic: GNOME GNOME desktop environment and its underlying platform label Nov 19, 2018
@GrahamcOfBorg
Copy link

Failure on aarch64-linux (full log)

Attempted: glib, meson, ninja

Partial log (click to expand)

bootstrap complete.  rebuilding...
installing
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/byhldspwspzjjs9325ghyjj0qb8c4fhi-ninja-1.8.2
shrinking /nix/store/byhldspwspzjjs9325ghyjj0qb8c4fhi-ninja-1.8.2/bin/ninja
strip is /nix/store/1jprj383qnzd50vn8qq3a0id6a08a9fi-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/byhldspwspzjjs9325ghyjj0qb8c4fhi-ninja-1.8.2/bin
patching script interpreter paths in /nix/store/byhldspwspzjjs9325ghyjj0qb8c4fhi-ninja-1.8.2
checking for references to /build/ in /nix/store/byhldspwspzjjs9325ghyjj0qb8c4fhi-ninja-1.8.2...
error: build of '/nix/store/zyh2zgqv8zqvnzbirwh2asqzcrjhrji2-meson-0.48.2.drv' failed

@GrahamcOfBorg
Copy link

Failure on x86_64-linux (full log)

Attempted: glib, meson, ninja

Partial log (click to expand)

patching file mesonbuild/compilers/compilers.py
patching file mesonbuild/scripts/depfixer.py
applying patch /nix/store/f8hlcmkcwvzamf6iikb7vcz19g4clyhi-a87496addd9160300837aa50193f4798c6f1d251.patch
patching file mesonbuild/compilers/compilers.py
Reversed (or previously applied) patch detected!  Assume -R? [n]
Apply anyway? [n]
Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file mesonbuild/compilers/compilers.py.rej
builder for '/nix/store/0vb7x0jzn1gjczqnacyvrxrpc4c9qq3a-meson-0.48.2.drv' failed with exit code 1
error: build of '/nix/store/0vb7x0jzn1gjczqnacyvrxrpc4c9qq3a-meson-0.48.2.drv' failed

@GrahamcOfBorg
Copy link

Failure on x86_64-linux (full log)

Attempted: glib, meson, ninja

Partial log (click to expand)

bootstrap complete.  rebuilding...
installing
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/5iwmainsgwprzjr6lyrl62lxx73x81l1-ninja-1.8.2
shrinking /nix/store/5iwmainsgwprzjr6lyrl62lxx73x81l1-ninja-1.8.2/bin/ninja
strip is /nix/store/j13c9z0z495wxdc97if8z451x53m1j25-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/5iwmainsgwprzjr6lyrl62lxx73x81l1-ninja-1.8.2/bin
patching script interpreter paths in /nix/store/5iwmainsgwprzjr6lyrl62lxx73x81l1-ninja-1.8.2
checking for references to /build/ in /nix/store/5iwmainsgwprzjr6lyrl62lxx73x81l1-ninja-1.8.2...
error: build of '/nix/store/0vb7x0jzn1gjczqnacyvrxrpc4c9qq3a-meson-0.48.2.drv' failed

@GrahamcOfBorg
Copy link

Failure on aarch64-linux (full log)

Attempted: glib, meson, ninja

Partial log (click to expand)

bootstrap complete.  rebuilding...
installing
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/sxzwfwsjsbqvsbf8bgyi92w24vamdrdh-ninja-1.8.2
shrinking /nix/store/sxzwfwsjsbqvsbf8bgyi92w24vamdrdh-ninja-1.8.2/bin/ninja
strip is /nix/store/1jprj383qnzd50vn8qq3a0id6a08a9fi-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/sxzwfwsjsbqvsbf8bgyi92w24vamdrdh-ninja-1.8.2/bin
patching script interpreter paths in /nix/store/sxzwfwsjsbqvsbf8bgyi92w24vamdrdh-ninja-1.8.2
checking for references to /build/ in /nix/store/sxzwfwsjsbqvsbf8bgyi92w24vamdrdh-ninja-1.8.2...
error: build of '/nix/store/zyh2zgqv8zqvnzbirwh2asqzcrjhrji2-meson-0.48.2.drv' failed

@orivej
Copy link
Contributor

orivej commented Nov 19, 2018

I have looked up how cmake and meson setup ninja test: with cmake it runs ctest --force-new-ctest-process and with meson it runs meson test --no-rebuild --print-errorlogs. The new ninja checkPhase seems to be an appropriate replacement for the meson checkPhase.

Things changed in the Ninja setup-hook:
- Respect installFlags
- Automatically add checkPhase (can be disabled with dontUseNinjaCheck
  in the same way as dontUseNinjaBuild and dontUseNinjaInstall). Tests
  are only run when "ninja test" exists.
- Error in build phase when build.ninja is missing. We don’t have a
  way to fall back to other build methods, so it’s best to be very
  clear when we aren’t able to build with ninja
- Set -l flag to 1 when enableParallelBuilding is disabled
This is now handled in the ninja setup hook.

(cherry picked from commit f5e0997)
This is now handled in ninja.
These are already in the generated makefiles!
These don’t have much use in ninja, so easiest to leave them out.
This can be set unconditionally to $NIX_BUILD_CORES according to
@orivej.
@GrahamcOfBorg
Copy link

Failure on aarch64-linux (full log)

Attempted: meson, ninja

Partial log (click to expand)

bootstrap complete.  rebuilding...
installing
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/2bsynb359mrr8rfkvvjri7p3yngjydyl-ninja-1.8.2
shrinking /nix/store/2bsynb359mrr8rfkvvjri7p3yngjydyl-ninja-1.8.2/bin/ninja
strip is /nix/store/1jprj383qnzd50vn8qq3a0id6a08a9fi-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/2bsynb359mrr8rfkvvjri7p3yngjydyl-ninja-1.8.2/bin
patching script interpreter paths in /nix/store/2bsynb359mrr8rfkvvjri7p3yngjydyl-ninja-1.8.2
checking for references to /build/ in /nix/store/2bsynb359mrr8rfkvvjri7p3yngjydyl-ninja-1.8.2...
error: build of '/nix/store/zyh2zgqv8zqvnzbirwh2asqzcrjhrji2-meson-0.48.2.drv' failed

@GrahamcOfBorg
Copy link

Failure on x86_64-linux (full log)

Attempted: meson, ninja

Partial log (click to expand)

bootstrap complete.  rebuilding...
installing
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/rvq00k7ch3kdzlwgdg0sax8ink6z1xsr-ninja-1.8.2
shrinking /nix/store/rvq00k7ch3kdzlwgdg0sax8ink6z1xsr-ninja-1.8.2/bin/ninja
strip is /nix/store/j13c9z0z495wxdc97if8z451x53m1j25-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/rvq00k7ch3kdzlwgdg0sax8ink6z1xsr-ninja-1.8.2/bin
patching script interpreter paths in /nix/store/rvq00k7ch3kdzlwgdg0sax8ink6z1xsr-ninja-1.8.2
checking for references to /build/ in /nix/store/rvq00k7ch3kdzlwgdg0sax8ink6z1xsr-ninja-1.8.2...
error: build of '/nix/store/0vb7x0jzn1gjczqnacyvrxrpc4c9qq3a-meson-0.48.2.drv' failed

Copy link
Contributor

@orivej orivej left a comment

Choose a reason for hiding this comment

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

I can't reproduce ofborg failure…

fi
echoCmd 'build flags' "${flagsArray[@]}"
ninja "${flagsArray[@]}"
unset flagsArray
Copy link
Contributor

Choose a reason for hiding this comment

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

I have just noticed: since flagsArray is local, we don't have to unset it.

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 noticed that too but thought it might be to avoid it leaking into the post hook?

Copy link
Contributor

Choose a reason for hiding this comment

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

runHook is a function, it has a new scope without local variables of the current function.

@GrahamcOfBorg
Copy link

Timed out, unknown build status on x86_64-darwin (full log)

Attempted: glib, meson, ninja

Partial log (click to expand)

cannot build derivation '/nix/store/d6fsin2smra7g390z862fdvjbk63zw7q-libxml2-2.9.8.drv': 3 dependencies couldn't be built
cannot build derivation '/nix/store/9c97hslvfkd9xz4iyh7drcnfvkajqz5k-libxslt-1.1.32.drv': 4 dependencies couldn't be built
cannot build derivation '/nix/store/k0jid42z9m7jjfhfwzjl98hlyk3pxhks-ninja-1.8.2.drv': 7 dependencies couldn't be built
cannot build derivation '/nix/store/5ag7hcglas7vs7495xx583zmpmcryl6q-swift-corefoundation.drv': 6 dependencies couldn't be built
cannot build derivation '/nix/store/wxdqhk8ahxz24jv7fm10s4pmmld5c895-python3-3.7.1.drv': 9 dependencies couldn't be built
cannot build derivation '/nix/store/asmk1fp8dj48mwjdrg9vm6z8rr2fg1y4-hook.drv': 3 dependencies couldn't be built
cannot build derivation '/nix/store/xnf9fwibx1z6grjlp7vfydddn84wbl99-python3.7-bootstrapped-pip-18.1.drv': 4 dependencies couldn't be built
cannot build derivation '/nix/store/8lvyw58l01saz97kjia06c8vfpi74sm2-python3.7-setuptools-40.4.3.drv': 4 dependencies couldn't be built
cannot build derivation '/nix/store/hp988qnb31qxqvdi7s3lyx0jk931h3c3-meson-0.48.2.drv': 9 dependencies couldn't be built
error: build of '/nix/store/hp988qnb31qxqvdi7s3lyx0jk931h3c3-meson-0.48.2.drv', '/nix/store/k0jid42z9m7jjfhfwzjl98hlyk3pxhks-ninja-1.8.2.drv', '/nix/store/ycdsz5ld11qdmzdahalm13i4i485aynk-glib-2.56.0.drv' failed

export LD_LIBRARY_PATH=$(readlink -f ./src)
CTEST_OUTPUT_ON_FAILURE=1 make test
export CTEST_OUTPUT_ON_FAILURE=1
Copy link
Contributor

@orivej orivej Nov 19, 2018

Choose a reason for hiding this comment

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

CTEST_OUTPUT_ON_FAILURE ought to be the default (at least on Hydra), since without it ctest prints that the test has failed without any details. Shall we initialize it in the cmake setup hook (if it was unset)?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. Also maybe CTEST_PARALLEL_LEVEL?

Copy link
Contributor

Choose a reason for hiding this comment

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

Great idea! (The derivation may explicitly set it back to 1 if the tests don't support concurrency.)

@GrahamcOfBorg
Copy link

Timed out, unknown build status on x86_64-darwin (full log)

Attempted: glib, meson, ninja

Partial log (click to expand)

cannot build derivation '/nix/store/v63haq0fj0l3sfcx1dkqimfpmhbnji11-libxml2-2.9.8.drv': 3 dependencies couldn't be built
cannot build derivation '/nix/store/xnqwzshd2asv9i071ff1mwszxaw6zv66-libxslt-1.1.32.drv': 4 dependencies couldn't be built
cannot build derivation '/nix/store/9s0gz1znxm58ccw27ag6nk1i2paxqvk6-ninja-1.8.2.drv': 7 dependencies couldn't be built
cannot build derivation '/nix/store/czbs24hc7yilyc8sw47vr8j7xfk829f6-swift-corefoundation.drv': 6 dependencies couldn't be built
cannot build derivation '/nix/store/4mhz75b5m8k8flz8va6f9kpmw0ayakvn-python3-3.7.1.drv': 9 dependencies couldn't be built
cannot build derivation '/nix/store/yv7fwsd2vyg3bjjkrfhwp5x6al2zqmd9-hook.drv': 3 dependencies couldn't be built
cannot build derivation '/nix/store/4slmafmd1nxh71smpibc79hq7hxkxna4-python3.7-bootstrapped-pip-18.1.drv': 4 dependencies couldn't be built
cannot build derivation '/nix/store/i1kclcx3sy506p17dlgr32gqr6zipca1-python3.7-setuptools-40.4.3.drv': 4 dependencies couldn't be built
cannot build derivation '/nix/store/kgqzr5vsil4ak8rgxh0bcc31dbcr80vf-meson-0.48.2.drv': 9 dependencies couldn't be built
error: build of '/nix/store/9s0gz1znxm58ccw27ag6nk1i2paxqvk6-ninja-1.8.2.drv', '/nix/store/kgqzr5vsil4ak8rgxh0bcc31dbcr80vf-meson-0.48.2.drv', '/nix/store/z91kldqyf6fjy2fiwkd3b280r1yw7bbq-glib-2.56.0.drv' failed

@GrahamcOfBorg
Copy link

Timed out, unknown build status on x86_64-darwin (full log)

Attempted: meson, ninja

Partial log (click to expand)

cannot build derivation '/nix/store/izwwqcv1dhc13ywlb1k33q4yn7sdsm9m-libxml2-2.9.8.drv': 3 dependencies couldn't be built
cannot build derivation '/nix/store/5j3p76750crbnc8p6rjff741kk513yya-libxslt-1.1.32.drv': 4 dependencies couldn't be built
cannot build derivation '/nix/store/3zyga9vikfqsxq9kbsvgv2s0ygdbsr1r-ninja-1.8.2.drv': 7 dependencies couldn't be built
cannot build derivation '/nix/store/m99lf43y7snjar14j8j8wixrg24d0kx6-swift-corefoundation.drv': 6 dependencies couldn't be built
cannot build derivation '/nix/store/n65m1qj9dkw4b9pzb5j51viknxnq5zbm-python3-3.7.1.drv': 9 dependencies couldn't be built
cannot build derivation '/nix/store/kix9rp51yrnadx3h3hwybqzhjdk1h0j4-hook.drv': 3 dependencies couldn't be built
cannot build derivation '/nix/store/qg3fisjs8gwzdb4kfq14gv1jwxpfqr7i-python3.7-bootstrapped-pip-18.1.drv': 4 dependencies couldn't be built
cannot build derivation '/nix/store/y2fp2yh6i8qkinc2mbrqy35rzi8p5zqv-python3.7-setuptools-40.4.3.drv': 4 dependencies couldn't be built
cannot build derivation '/nix/store/xs3jnwy409pygiqyv9rwqcmpm5a1s5s9-meson-0.48.2.drv': 9 dependencies couldn't be built
error: build of '/nix/store/3zyga9vikfqsxq9kbsvgv2s0ygdbsr1r-ninja-1.8.2.drv', '/nix/store/xs3jnwy409pygiqyv9rwqcmpm5a1s5s9-meson-0.48.2.drv' failed

@jtojnar
Copy link
Contributor

jtojnar commented Nov 19, 2018

As a side note, it would be nice to have support for wrapping tests in the setup hooks so that we do not need to do

checkPhase = ''
export NO_AT_BRIDGE=1
xvfb-run -s '-screen 0 800x600x24' dbus-run-session \
--config-file=${dbus.daemon}/share/dbus-1/session.conf \
meson test --print-errorlogs
'';

@matthewbauer
Copy link
Member Author

As a side note, it would be nice to have support for wrapping tests in the setup hooks so that we do not need to do

nixpkgs/pkgs/development/libraries/libdazzle/default.nix
Lines 28 to 33 in 0925c48
checkPhase = ''
export NO_AT_BRIDGE=1
xvfb-run -s '-screen 0 800x600x24' dbus-run-session \
--config-file=${dbus.daemon}/share/dbus-1/session.conf \
meson test --print-errorlogs
'';

Yes! This would be nice to abstract out. It would also be useful with my "exeWrapper" work:

#50212

So, you could run tests after cross compiling. It gets a little bit complicated because you may not have all of the right tools cross built in this case, but it's a similar principle to dbus-run-session.

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: cmake, meson, ninja

Partial log (click to expand)

shrinking /nix/store/7likmi7hhwzmi5mqsbi63ja4vkwwyfij-cmake-3.12.1/bin/cpack
shrinking /nix/store/7likmi7hhwzmi5mqsbi63ja4vkwwyfij-cmake-3.12.1/bin/ctest
shrinking /nix/store/7likmi7hhwzmi5mqsbi63ja4vkwwyfij-cmake-3.12.1/bin/cmake
strip is /nix/store/1jprj383qnzd50vn8qq3a0id6a08a9fi-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/7likmi7hhwzmi5mqsbi63ja4vkwwyfij-cmake-3.12.1/bin
patching script interpreter paths in /nix/store/7likmi7hhwzmi5mqsbi63ja4vkwwyfij-cmake-3.12.1
/nix/store/7likmi7hhwzmi5mqsbi63ja4vkwwyfij-cmake-3.12.1/share/cmake-3.12/Modules/CPack.STGZ_Header.sh.in: interpreter directive changed from "/bin/sh" to "/nix/store/vg9477j4nafj505cr9agvgndxys7743x-bash-4.4-p23/bin/sh"
/nix/store/7likmi7hhwzmi5mqsbi63ja4vkwwyfij-cmake-3.12.1/share/cmake-3.12/Modules/Squish4RunTestCase.sh: interpreter directive changed from "/bin/sh" to "/nix/store/vg9477j4nafj505cr9agvgndxys7743x-bash-4.4-p23/bin/sh"
/nix/store/7likmi7hhwzmi5mqsbi63ja4vkwwyfij-cmake-3.12.1/share/cmake-3.12/Modules/SquishRunTestCase.sh: interpreter directive changed from "/bin/sh" to "/nix/store/vg9477j4nafj505cr9agvgndxys7743x-bash-4.4-p23/bin/sh"
checking for references to /build/ in /nix/store/7likmi7hhwzmi5mqsbi63ja4vkwwyfij-cmake-3.12.1...

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: cmake, meson, ninja

Partial log (click to expand)

shrinking /nix/store/2jv92s1gab5v15v9h2vh992xs9wpmwin-cmake-3.12.1/bin/ctest
shrinking /nix/store/2jv92s1gab5v15v9h2vh992xs9wpmwin-cmake-3.12.1/bin/cpack
shrinking /nix/store/2jv92s1gab5v15v9h2vh992xs9wpmwin-cmake-3.12.1/bin/cmake
strip is /nix/store/j13c9z0z495wxdc97if8z451x53m1j25-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/2jv92s1gab5v15v9h2vh992xs9wpmwin-cmake-3.12.1/bin
patching script interpreter paths in /nix/store/2jv92s1gab5v15v9h2vh992xs9wpmwin-cmake-3.12.1
/nix/store/2jv92s1gab5v15v9h2vh992xs9wpmwin-cmake-3.12.1/share/cmake-3.12/Modules/SquishRunTestCase.sh: interpreter directive changed from "/bin/sh" to "/nix/store/qnp0bgn3icxrwcnnhz4pcjynxbcnxfv9-bash-4.4-p23/bin/sh"
/nix/store/2jv92s1gab5v15v9h2vh992xs9wpmwin-cmake-3.12.1/share/cmake-3.12/Modules/Squish4RunTestCase.sh: interpreter directive changed from "/bin/sh" to "/nix/store/qnp0bgn3icxrwcnnhz4pcjynxbcnxfv9-bash-4.4-p23/bin/sh"
/nix/store/2jv92s1gab5v15v9h2vh992xs9wpmwin-cmake-3.12.1/share/cmake-3.12/Modules/CPack.STGZ_Header.sh.in: interpreter directive changed from "/bin/sh" to "/nix/store/qnp0bgn3icxrwcnnhz4pcjynxbcnxfv9-bash-4.4-p23/bin/sh"
checking for references to /build/ in /nix/store/2jv92s1gab5v15v9h2vh992xs9wpmwin-cmake-3.12.1...

@GrahamcOfBorg
Copy link

Timed out, unknown build status on x86_64-darwin (full log)

Attempted: cmake, meson, ninja

Partial log (click to expand)

cannot build derivation '/nix/store/nvnmlpi78k3f505m5aydk0rhx5m6apii-libxslt-1.1.32.drv': 4 dependencies couldn't be built
cannot build derivation '/nix/store/60pnfr7mwnc9p934kyhm5vl357n36g6y-cmake-3.12.1.drv': 9 dependencies couldn't be built
cannot build derivation '/nix/store/nj8hhjh47zqykn9dq4lrwfgx7q69fn9d-ninja-1.8.2.drv': 7 dependencies couldn't be built
cannot build derivation '/nix/store/9d2bljywa8zr2r7k1lcshvjpi2d938rl-swift-corefoundation.drv': 6 dependencies couldn't be built
cannot build derivation '/nix/store/g40fd5kc6wyy7lxa4cazppyq4vvdqdgc-python3-3.7.1.drv': 9 dependencies couldn't be built
cannot build derivation '/nix/store/ifz1pzgb9vwb1djs5skxcswf0bw81q1m-hook.drv': 3 dependencies couldn't be built
cannot build derivation '/nix/store/whk0z66j59g7n192wrf5zqc2g7ix5wcv-python3.7-bootstrapped-pip-18.1.drv': 4 dependencies couldn't be built
cannot build derivation '/nix/store/9c0i3kacv4xgnj5rcpgpccjyj0zxaisn-python3.7-setuptools-40.4.3.drv': 4 dependencies couldn't be built
cannot build derivation '/nix/store/b29065aij7w8dswxjy7g2a6hd7jxwbnm-meson-0.48.2.drv': 9 dependencies couldn't be built
error: build of '/nix/store/60pnfr7mwnc9p934kyhm5vl357n36g6y-cmake-3.12.1.drv', '/nix/store/b29065aij7w8dswxjy7g2a6hd7jxwbnm-meson-0.48.2.drv', '/nix/store/nj8hhjh47zqykn9dq4lrwfgx7q69fn9d-ninja-1.8.2.drv' failed

@matthewbauer
Copy link
Member Author

@GrahamcOfBorg build cmark at-spi2-atk

@GrahamcOfBorg
Copy link

Timed out, unknown build status on x86_64-darwin (full log)

Attempted: cmark, at-spi2-atk

Partial log (click to expand)

cannot build derivation '/nix/store/dfqabdp28vlv7a17f3j51pdscfhkgchn-apple-framework-Foundation.drv': 7 dependencies couldn't be built
cannot build derivation '/nix/store/wkrk521h2swd0xabcsgg96ha910pgwwd-apple-framework-QuartzCore.drv': 6 dependencies couldn't be built
cannot build derivation '/nix/store/bkccj6ahzwyqpfwzv1b9665y6chhsy13-apple-framework-Carbon.drv': 9 dependencies couldn't be built
cannot build derivation '/nix/store/d06pxzq36jpqxy8cz135yrl0zazjyvm0-cairo-1.16.0.drv': 17 dependencies couldn't be built
cannot build derivation '/nix/store/jgp3g91gnd149vl8a83bd0lfi6v0gwn5-absolute_gir_path.patch.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/8v4v4vhsrp30cw6hswa3kgsj9j7fivf8-gobject-introspection-1.56.0.drv': 10 dependencies couldn't be built
cannot build derivation '/nix/store/zp1443h950s80adljz684353zgqm5nws-at-spi2-core-2.28.0.drv': 11 dependencies couldn't be built
cannot build derivation '/nix/store/cihh91mmcnb8hlyq9qhj53q78hci1mch-atk-2.28.1.drv': 8 dependencies couldn't be built
cannot build derivation '/nix/store/ahlhx5hiyvhlpq3va13d6g3d5bzf0ba3-at-spi2-atk-2.26.2.drv': 10 dependencies couldn't be built
error: build of '/nix/store/ahlhx5hiyvhlpq3va13d6g3d5bzf0ba3-at-spi2-atk-2.26.2.drv', '/nix/store/kvypd8kny63v0b4z6qjhx19s8k7gqw6m-cmark-0.28.3.drv' failed

@GrahamcOfBorg
Copy link

Timed out, unknown build status on x86_64-linux (full log)

Attempted: cmark, at-spi2-atk

Partial log (click to expand)

checking for references to /build/ in /nix/store/g610yh13619ac0k35nd2r4kgcpp4q2nk-dbus-1.12.10-lib...
shrinking RPATHs of ELF executables and libraries in /nix/store/d2p8adj78ga9zr6bbwddn8r7xmm89498-dbus-1.12.10-doc
strip is /nix/store/j13c9z0z495wxdc97if8z451x53m1j25-binutils-2.30/bin/strip
patching script interpreter paths in /nix/store/d2p8adj78ga9zr6bbwddn8r7xmm89498-dbus-1.12.10-doc
checking for references to /build/ in /nix/store/d2p8adj78ga9zr6bbwddn8r7xmm89498-dbus-1.12.10-doc...
Moving /nix/store/hizdfbiand4709p71fh2v7h4ahm43h9f-dbus-1.12.10/bin/dbus-launch to /nix/store/g610yh13619ac0k35nd2r4kgcpp4q2nk-dbus-1.12.10-lib/bin/dbus-launch
rmdir: failed to remove '/nix/store/hizdfbiand4709p71fh2v7h4ahm43h9f-dbus-1.12.10/bin': Directory not empty
cannot build derivation '/nix/store/4vw4jnlz2jhq3958vm0r33dp2z60zbw6-at-spi2-core-2.28.0.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/1zll3pp7nk9znrwdlvg33sls3ivj20qg-at-spi2-atk-2.26.2.drv': 2 dependencies couldn't be built
error: build of '/nix/store/1zll3pp7nk9znrwdlvg33sls3ivj20qg-at-spi2-atk-2.26.2.drv' failed

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: cmark, at-spi2-atk

Partial log (click to expand)

post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/0x4wyn65ybl7b0ll14lnww2023is8lkr-at-spi2-atk-2.26.2
shrinking /nix/store/0x4wyn65ybl7b0ll14lnww2023is8lkr-at-spi2-atk-2.26.2/lib/gtk-2.0/modules/libatk-bridge.so
shrinking /nix/store/0x4wyn65ybl7b0ll14lnww2023is8lkr-at-spi2-atk-2.26.2/lib/libatk-bridge-2.0.so.0.0.0
strip is /nix/store/1jprj383qnzd50vn8qq3a0id6a08a9fi-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/0x4wyn65ybl7b0ll14lnww2023is8lkr-at-spi2-atk-2.26.2/lib
patching script interpreter paths in /nix/store/0x4wyn65ybl7b0ll14lnww2023is8lkr-at-spi2-atk-2.26.2
checking for references to /build/ in /nix/store/0x4wyn65ybl7b0ll14lnww2023is8lkr-at-spi2-atk-2.26.2...
/nix/store/gk48bwkkmj4i47vnp2jznpvq1ldcxy2c-cmark-0.28.3
/nix/store/0x4wyn65ybl7b0ll14lnww2023is8lkr-at-spi2-atk-2.26.2

@matthewbauer matthewbauer merged commit d492f53 into NixOS:staging Nov 20, 2018
@nixos-discourse
Copy link

This pull request has been mentioned on Nix community. There might be relevant details there:

https://discourse.nixos.org/t/using-xvfb-in-checkphase/1497/3

Copy link
Member

@knedlsepp knedlsepp left a comment

Choose a reason for hiding this comment

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

A little late to the party, but I think this might not work for cmake without ninja as we don't set checkTarget to "test" there (yet).

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.

None yet

6 participants