diff --git a/mycpp/common.sh b/mycpp/common.sh index 7d9c460ebf..bfec9cfd32 100644 --- a/mycpp/common.sh +++ b/mycpp/common.sh @@ -13,4 +13,4 @@ if test -z "${REPO_ROOT:-}"; then exit 1 fi -readonly MYPY_REPO=$REPO_ROOT/_clone/mypy +readonly MYPY_REPO=$REPO_ROOT/../oil_DEPS/_clone/mypy diff --git a/mycpp/deps.sh b/mycpp/deps.sh index e7f13f49c0..480cb3e5b1 100755 --- a/mycpp/deps.sh +++ b/mycpp/deps.sh @@ -42,7 +42,7 @@ git-clone() { } create-venv() { - local dir=_tmp/mycpp-venv + local dir=../oil_DEPS/mycpp-venv python3 -m venv $dir ls -l $dir @@ -66,7 +66,7 @@ pip-install() { set +o nounset set +o pipefail set +o errexit - source _tmp/mycpp-venv/bin/activate + source ../oil_DEPS/mycpp-venv/bin/activate mypy-deps # install deps in virtual env diff --git a/soil/host-shim.sh b/soil/host-shim.sh index 9c19ac4112..b4d9b0fec6 100755 --- a/soil/host-shim.sh +++ b/soil/host-shim.sh @@ -28,6 +28,7 @@ run-job-uke() { local docker=$1 # docker or podman local repo_root=$2 local task=$3 # e.g. dev-minimal + local debug_shell=${4:-} local -a flags=() @@ -50,10 +51,28 @@ run-job-uke() { command time -p -o $metadata_dir/image-pull-time.txt \ $docker pull $image + local -a args + if test -n "$debug_shell"; then + # launch interactive shell + flags+=( -i -t ) + + # So we can run GDB + # https://stackoverflow.com/questions/35860527/warning-error-disabling-address-space-randomization-operation-not-permitted + flags+=( --cap-add SYS_PTRACE --security-opt seccomp=unconfined ) + + # can mount other tools for debugging, like clang + #local clang_dir=~/git/oilshell/oil_DEPS/clang+llvm-14.0.0-x86_64-linux-gnu-ubuntu-18.04 + #flags+=( --mount "type=bind,source=$clang_dir,target=/home/uke/oil_DEPS/$(basename $clang_dir)" ) + + args=(bash) + else + args=(sh -c "cd /home/uke/oil; soil/worker.sh run-$task") + fi + $docker run "${flags[@]}" \ --mount "type=bind,source=$repo_root,target=/home/uke/oil" \ $image \ - sh -c "cd /home/uke/oil; soil/worker.sh run-$task" + "${args[@]}" } local-test-uke() { @@ -62,7 +81,7 @@ local-test-uke() { local branch=$(git rev-parse --abbrev-ref HEAD) - local fresh_clone=/tmp/oil + local fresh_clone=/tmp/oil # TODO: /tmp/soil-$task rm -r -f -v $fresh_clone local this_repo=$PWD @@ -75,6 +94,14 @@ local-test-uke() { sudo $0 run-job-uke docker $fresh_clone $task } +local-shell() { + local task=${1:-cpp} + + local repo_root=/tmp/oil # TODO: /tmp/soil-$task + # Run bash as debug shell + sudo $0 run-job-uke docker $repo_root $task bash +} + cleanup() { sudo rm -r -f -v _tmp/soil sudo rm -r -f -v /tmp/oil diff --git a/test/spec-cpp.sh b/test/spec-cpp.sh index 5eafd70174..ddb15d7288 100755 --- a/test/spec-cpp.sh +++ b/test/spec-cpp.sh @@ -371,4 +371,10 @@ one-off() { #run-with-osh-eval builtin-io -r 54 -v # to_float() } +repro() { + test/spec.sh alias -r 0 -p > _tmp/a + ninja _bin/clang-dbg/osh_eval + _bin/clang-dbg/osh_eval _tmp/a +} + "$@"