python3.tests: add cpython-gdb test

main
Robert Scott 3 years ago
parent 049444dc6b
commit f8831c10de
  1. 18
      pkgs/development/interpreters/python/tests.nix
  2. 22
      pkgs/development/interpreters/python/tests/test_cpython_gdb/default.nix

@ -94,12 +94,18 @@ let
# Integration tests involving the package set.
# All PyPy package builds are broken at the moment
integrationTests = lib.optionalAttrs (python.pythonAtLeast "3.7" && (!python.isPyPy)) rec {
# Before the addition of NIX_PYTHONPREFIX mypy was broken with typed packages
nix-pythonprefix-mypy = callPackage ./tests/test_nix_pythonprefix {
interpreter = python;
};
};
integrationTests = lib.optionalAttrs (!python.isPyPy) (
lib.optionalAttrs (python.isPy3k && !stdenv.isDarwin) { # darwin has no split-debug
cpython-gdb = callPackage ./tests/test_cpython_gdb {
interpreter = python;
};
} // lib.optionalAttrs (python.pythonAtLeast "3.7") rec {
# Before the addition of NIX_PYTHONPREFIX mypy was broken with typed packages
nix-pythonprefix-mypy = callPackage ./tests/test_nix_pythonprefix {
interpreter = python;
};
}
);
# Tests to ensure overriding works as expected.
overrideTests = let

@ -0,0 +1,22 @@
{ interpreter, lib, gdb, writeText, runCommand }:
let
crashme-py = writeText "crashme.py" ''
import ctypes
def sentinel_foo_bar():
ctypes.memset(0, 1, 1)
sentinel_foo_bar()
'';
in runCommand "python-gdb" {} ''
# test that gdb is able to recover the python stack frame of this segfault
${gdb}/bin/gdb -batch -ex 'set debug-file-directory ${interpreter.debug}/lib/debug' \
-ex 'source ${interpreter}/share/gdb/libpython.py' \
-ex r \
-ex py-bt \
--args ${interpreter}/bin/python ${crashme-py} | grep 'in sentinel_foo_bar' > /dev/null
# success.
touch $out
''
Loading…
Cancel
Save