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

DLPX-87572 sdb: want live kernel tests to find kernel regressions early #337

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/scripts/install-libkdumpfile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
23 changes: 23 additions & 0 deletions .github/scripts/install-live-kernel-dbg.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash -eux

# uname -a
# uname -r
# 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 install ubuntu-dbgsym-keyring
# sudo apt-get clean
# sudo apt-get update
# sudo apt-get install -y linux-image-$(uname -r)-dbgsym

kvers=$(uname -r)
ddeb_file=$(curl http://ddebs.ubuntu.com/pool/main/l/linux-azure/ |
grep -Eo ">linux-image-(unsigned-)?$kvers(.*)amd64\.ddeb" |
cut -c2-)

wget http://ddebs.ubuntu.com/pool/main/l/linux-azure/$ddeb_file
sudo dpkg -i $ddeb_file
rm $ddeb_file
9 changes: 9 additions & 0 deletions .github/scripts/install-python-dev.sh
Original file line number Diff line number Diff line change
@@ -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)
95 changes: 72 additions & 23 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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".
Expand All @@ -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
Expand All @@ -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 }}
Expand All @@ -73,13 +56,79 @@ 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 common linux SDB commands can run on the latest Github Ubuntu kernel
#
live_ubuntu_latest:
runs-on: ubuntu-latest
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
Expand All @@ -104,7 +153,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
Expand Down
81 changes: 81 additions & 0 deletions tests/scripts/test_live_kernel.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#!/bin/bash -eu

scmds=(
# Test `stacks`
"stacks"

# Test `dmesg`
"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

zfs_scmds=(
# Test `arc`
"arc"

# Test `zfs_dbgmsg`
"zfs_dbgmsg"

# Test `zio`
"zio"

# Test `spa`
"spa -vmH"

# Test `vdev` and `metaslab`
"spa | vdev | metaslab"

# Test `vdev` and `metaslab` and `range_tree`
"spa | vdev | metaslab | head 1 | member ms_allocatable | range_tree"

# Test `dbuf`
"dbuf"

# Test `dbuf` and `blkptr`
"dbuf | head 1 | member db_blkptr | blkptr"

# Test `spa` and `zhist`
"spa | member spa_normal_class.mc_histogram | zhist"

# Test `avl`
"address spa_namespace_avl | avl"

# Test `spl_kmem_caches`
"spl_kmem_caches"
)

if $(lsmod | grep -q zfs); then
echo "Detected ZFS kernel module... testing ZFS commands:"
for ((i = 0; i < ${#zfs_scmds[@]}; i++)); do
sudo /usr/local/bin/sdb -e "${zfs_scmds[$i]}"
done
else
echo "Can't find ZFS kernel module... skipping ZFS commands"
fi