From 37c294487c9293b50ffb3823cc3b2f8a744eda88 Mon Sep 17 00:00:00 2001 From: Serapheim Dimitropoulos Date: Thu, 17 Aug 2023 09:59:51 -0700 Subject: [PATCH] WIP --- .github/scripts/install-libkdumpfile.sh | 1 - .github/scripts/install-live-kernel-dbg.sh | 15 +++++ .github/scripts/install-python-dev.sh | 9 +++ .github/workflows/main.yml | 73 +++++++++++++++------- tests/scripts/test_live_kernel.sh | 41 ++++++++++++ 5 files changed, 115 insertions(+), 24 deletions(-) create mode 100755 .github/scripts/install-live-kernel-dbg.sh create mode 100755 .github/scripts/install-python-dev.sh create mode 100755 tests/scripts/test_live_kernel.sh diff --git a/.github/scripts/install-libkdumpfile.sh b/.github/scripts/install-libkdumpfile.sh index f99b9ac..2ba0e63 100755 --- a/.github/scripts/install-libkdumpfile.sh +++ b/.github/scripts/install-libkdumpfile.sh @@ -8,7 +8,6 @@ # sudo apt update sudo apt install autoconf automake liblzo2-dev libsnappy1v5 libtool pkg-config zlib1g-dev -sudo apt install python3.8-dev python3.9-dev git clone https://github.com/ptesarik/libkdumpfile.git diff --git a/.github/scripts/install-live-kernel-dbg.sh b/.github/scripts/install-live-kernel-dbg.sh new file mode 100755 index 0000000..35eb9d8 --- /dev/null +++ b/.github/scripts/install-live-kernel-dbg.sh @@ -0,0 +1,15 @@ +#!/bin/bash -eux + +cat /etc/apt/sources.list + +sudo apt-get clean +sudo apt-get update + +echo "deb http://ddebs.ubuntu.com $(lsb_release -cs) main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list.d/ddebs.list +echo "deb http://ddebs.ubuntu.com $(lsb_release -cs)-updates main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list.d/ddebs.list +echo "deb http://ddebs.ubuntu.com $(lsb_release -cs)-proposed main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list.d/ddebs.list +sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C8CAB6595FDFF622 +sudo apt-get clean +sudo apt-get update + +sudo apt-get install -y linux-image-$(uname -r)-dbgsym diff --git a/.github/scripts/install-python-dev.sh b/.github/scripts/install-python-dev.sh new file mode 100755 index 0000000..79e0d16 --- /dev/null +++ b/.github/scripts/install-python-dev.sh @@ -0,0 +1,9 @@ +#!/bin/bash -eux + +sudo apt update +sudo apt install python3.$(python3 --version | cut -d . -f 2)-dev + +# +# Debug statements +# +echo $(which python3) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3cade6b..be3d0ec 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,24 +6,6 @@ on: jobs: # - # Verify the build and installation of SDB. - # - install: - runs-on: ubuntu-20.04 - strategy: - matrix: - python-version: [3.8, 3.9] - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v1 - with: - python-version: ${{ matrix.python-version }} - - run: python3 setup.py install - # - # The statement below is used for debugging the Github job. - # - - run: python3 --version - # # Verify "pylint" runs successfully. # # Note, we need to have "drgn" installed in order to run "pylint". @@ -34,7 +16,7 @@ jobs: runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 - - uses: actions/setup-python@v1 + - uses: actions/setup-python@v4 with: python-version: '3.8' - run: ./.github/scripts/install-drgn.sh @@ -55,16 +37,17 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - python-version: [3.8, 3.9] + python-version: ['3.8', '3.9'] dump: [dump.201912060006.tar.lzma, dump.202303131823.tar.gz] env: AWS_DEFAULT_REGION: 'us-west-2' steps: - uses: actions/checkout@v2 - - uses: actions/setup-python@v1 + - uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - run: python3 -m pip install aws python-config pytest pytest-cov + - run: ./.github/scripts/install-python-dev.sh - run: ./.github/scripts/install-libkdumpfile.sh - run: ./.github/scripts/install-drgn.sh - run: ./.github/scripts/download-dump-from-s3.sh ${{ matrix.dump }} @@ -73,13 +56,57 @@ jobs: with: token: ${{ secrets.CODECOV_TOKEN }} # + # Verify common linux SDB commands can run on vanilla ubuntu kernels: 20.04 + # + live_ubuntu_20_04: + runs-on: ubuntu-20.04 + strategy: + matrix: + python-version: ['3.8', '3.9'] + env: + AWS_DEFAULT_REGION: 'us-west-2' + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - run: python3 -m pip install aws python-config pytest pytest-cov + - run: ./.github/scripts/install-python-dev.sh + - run: sudo ./.github/scripts/install-libkdumpfile.sh + - run: sudo ./.github/scripts/install-drgn.sh + - run: sudo ./.github/scripts/install-live-kernel-dbg.sh + - run: sudo python3 ./setup.py install + - run: sudo ./tests/scripts/test_live_kernel.sh + # + # Verify common linux SDB commands can run on vanilla ubuntu kernels: 22.04 + # + live_ubuntu_22_04: + runs-on: ubuntu-22.04 + strategy: + matrix: + python-version: ['3.10' , '3.11'] + env: + AWS_DEFAULT_REGION: 'us-west-2' + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - run: python3 -m pip install aws python-config pytest pytest-cov + - run: ./.github/scripts/install-python-dev.sh + - run: sudo ./.github/scripts/install-libkdumpfile.sh + - run: sudo ./.github/scripts/install-drgn.sh + - run: sudo ./.github/scripts/install-live-kernel-dbg.sh + - run: sudo python3 ./setup.py install + - run: sudo ./tests/scripts/test_live_kernel.sh + # # Verify "yapf" runs successfully. # yapf: runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 - - uses: actions/setup-python@v1 + - uses: actions/setup-python@v4 with: python-version: '3.8' - run: python3 -m pip install yapf @@ -104,7 +131,7 @@ jobs: runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 - - uses: actions/setup-python@v1 + - uses: actions/setup-python@v4 with: python-version: '3.8' - run: ./.github/scripts/install-drgn.sh diff --git a/tests/scripts/test_live_kernel.sh b/tests/scripts/test_live_kernel.sh new file mode 100755 index 0000000..5374b16 --- /dev/null +++ b/tests/scripts/test_live_kernel.sh @@ -0,0 +1,41 @@ +#!/bin/bash -eu + +scmds=( + # Test `stacks` + "stacks" + + # Test `dmesg` + # ==== + # Commented out until we fix: + # https://github.com/delphix/sdb/issues/336 + # ==== + # "dmesg" + + # Test `lxlist` + "addr modules | lxlist module list | member name" + + # Test `slabs` and `percpu` + "slabs | filter \"obj.name == 'kmalloc-8'\" | member cpu_slab | percpu 0 1" + + # Test `pid` + "pid 1" + + # Test `find_task` + "find_task 1 2" + + # Test `threads` + "threads" + + # Test `walk` and `slub_cache` walker + "slabs | filter \"obj.name == 'TCP'\" | walk" + + # Test `rbtree` walker + "addr vmap_area_root | rbtree vmap_area rb_node" + + # Test `fget` + "find_task 1 | fget 1 4" +) + +for ((i = 0; i < ${#scmds[@]}; i++)); do + sudo /usr/local/bin/sdb -e "${scmds[$i]}" +done