summary refs log tree commit diff
path: root/pkgs/development/tools/profiling
diff options
context:
space:
mode:
authorIvan Kozik <ivan@ludios.org>2018-12-25 11:05:01 +0000
committerFrederik Rietdijk <freddyrietdijk@fridh.nl>2019-09-06 21:48:58 +0200
commit96a099adb63b3bc7fcfe7de51649c5984a8e978b (patch)
tree3c1b669d4210e7bf9a20a573ad682f271b5e37e0 /pkgs/development/tools/profiling
parent175827f1edb74a197c85a00336f8f52fdf697f60 (diff)
downloadnixpkgs-96a099adb63b3bc7fcfe7de51649c5984a8e978b.tar
nixpkgs-96a099adb63b3bc7fcfe7de51649c5984a8e978b.tar.gz
nixpkgs-96a099adb63b3bc7fcfe7de51649c5984a8e978b.tar.bz2
nixpkgs-96a099adb63b3bc7fcfe7de51649c5984a8e978b.tar.lz
nixpkgs-96a099adb63b3bc7fcfe7de51649c5984a8e978b.tar.xz
nixpkgs-96a099adb63b3bc7fcfe7de51649c5984a8e978b.tar.zst
nixpkgs-96a099adb63b3bc7fcfe7de51649c5984a8e978b.zip
pyflame: fix the build on machines with kernel.yama.ptrace_scope > 0
Diffstat (limited to 'pkgs/development/tools/profiling')
-rw-r--r--pkgs/development/tools/profiling/pyflame/default.nix31
1 files changed, 29 insertions, 2 deletions
diff --git a/pkgs/development/tools/profiling/pyflame/default.nix b/pkgs/development/tools/profiling/pyflame/default.nix
index 58f8553197f..2467769ad3d 100644
--- a/pkgs/development/tools/profiling/pyflame/default.nix
+++ b/pkgs/development/tools/profiling/pyflame/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, autoreconfHook, coreutils, fetchFromGitHub, fetchpatch, pkgconfig
+{ stdenv, autoreconfHook, coreutils, fetchFromGitHub, fetchpatch, pkgconfig, procps
 # pyflame needs one python version per ABI
 # are currently supported
 # * 2.6 or 2.7 for 2.x ABI
@@ -67,11 +67,12 @@ stdenv.mkDerivation rec {
     full-ptrace-seize-errors
   ];
 
-  nativeBuildInputs = [ autoreconfHook pkgconfig ];
+  nativeBuildInputs = [ autoreconfHook pkgconfig procps ];
   buildInputs = [ python37 python36 python2 python35 ];
 
   postPatch = ''
     patchShebangs .
+
     # some tests will fail in the sandbox
     substituteInPlace tests/test_end_to_end.py \
       --replace 'skipif(IS_DOCKER' 'skipif(True'
@@ -79,6 +80,32 @@ stdenv.mkDerivation rec {
     # don't use patchShebangs here to be explicit about the python version
     substituteInPlace utils/flame-chart-json \
       --replace '#!usr/bin/env python' '#!${python3.interpreter}'
+
+    # Many tests require the build machine to have kernel.yama.ptrace_scope = 0,
+    # but hardened machines have it set to 1. On build machines that cannot run
+    # these tests, skip them to avoid breaking the build.
+    if [[ $(sysctl -n kernel.yama.ptrace_scope || echo 0) != "0" ]]; then
+      for test in \
+        test_monitor \
+        test_non_gil \
+        test_threaded \
+        test_unthreaded \
+        test_legacy_pid_handling \
+        test_exclude_idle \
+        test_exit_early \
+        test_sample_not_python \
+        test_include_ts \
+        test_include_ts_exclude_idle \
+        test_thread_dump \
+        test_no_line_numbers \
+        test_utf8_output; do
+
+        substituteInPlace tests/test_end_to_end.py \
+          --replace "def $test(" "\
+@pytest.mark.skip('build machine had kernel.yama.ptrace_scope != 0')
+def $test("
+      done
+    fi
   '';
 
   postInstall = ''