Skip to content

Commit

Permalink
Fix build error with workflow update
Browse files Browse the repository at this point in the history
  • Loading branch information
RinHizakura committed Oct 15, 2024
1 parent cdf2d80 commit e4b14aa
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 14 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/cargo-test-kexpr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: cargo-test-kexpr

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

env:
CARGO_TERM_COLOR: always

jobs:
install:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Get-submodule
run: git submodule update --init --recursive

- name: Install-linux-dbgsym
run: |
NAME=$(lsb_release -c | awk '{print $2}')
sudo tee /etc/apt/sources.list.d/ddebs.list << EOF
deb http://ddebs.ubuntu.com/ ${NAME} main restricted universe multiverse
deb http://ddebs.ubuntu.com/ ${NAME}-updates main restricted universe multiverse
EOF
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C8CAB6595FDFF622
sudo apt-get update
sudo apt-get install linux-image-$(uname -r)-dbgsym
- name: Install-dependencies
run: |
sudo apt-get update
sudo apt install autoconf automake check gcc clang llvm liblzma-dev libelf-dev libdw-dev libtool make pkgconf python3 python3-dev python3-pip python3-setuptools zlib1g-dev
- name: Install-bpftool
run: |
git clone https://github.com/libbpf/bpftool.git
cd bpftool
git submodule update --init
cd src; make; sudo make install
- name: Install-drgn
run: |
git clone https://github.com/osandov/drgn.git
cd drgn
python3 setup.py build
sudo python3 setup.py install
- name: Create-vmlinux-h
run: bpftool btf dump file /sys/kernel/btf/vmlinux format c > vmlinux.h

- name: Test
run: |
cargo clean
cargo build
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER='sudo -E' cargo test --target-dir test_build
15 changes: 5 additions & 10 deletions .github/workflows/cargo-test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Rust
name: cargo-test

on:
push:
Expand All @@ -22,6 +22,7 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install clang llvm libelf1 libelf-dev zlib1g-dev
- name: Install-bpftool
run: |
git clone https://github.com/libbpf/bpftool.git
Expand All @@ -32,14 +33,8 @@ jobs:
- name: Create-vmlinux-h
run: bpftool btf dump file /sys/kernel/btf/vmlinux format c > vmlinux.h

- name: Test-normal
run: |
cargo clean
cargo build --no-default-features kexpr
sudo cargo test --target-dir test_build
- name: Test-kexpr
- name: Test
run: |
cargo clean
cargo build
sudo cargo test --target-dir test_build
cargo build --no-default-features
cargo test --no-default-features --target-dir test_build
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ ifeq ($(ARCH), )
CARGO_OPT =

ifeq ("$(wildcard /proc/kcore)", "")
BUILD_FEATURE += --no-default-features kexpr
BUILD_FEATURE += --no-default-features
endif

ifneq ("$(wildcard /sys/kernel/btf/vmlinux)", "")
Expand Down Expand Up @@ -64,7 +64,7 @@ check:
# FIXME: This will create file with super user permission. We
# better avoid this if possible.
test:
sudo cargo test --features kexpr --target-dir test_build
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER='sudo -E' cargo test --target-dir test_build

clean:
cargo clean
Expand Down
1 change: 0 additions & 1 deletion src/kexpr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,6 @@ mod kexpr_tests {
&String::from_utf8(
Command::new("./tests/kexpr.py")
.args($args)
.stdout(Stdio::piped())
.output()
.expect("Fail to execute kexpr")
.stdout,
Expand Down
2 changes: 1 addition & 1 deletion src/msg/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ struct MsgEnt {
id: u64,
typ: u64,
pid: u64,
cmd: [c_char; TASK_COMM_LEN],
cmd: [u8; TASK_COMM_LEN],
}
unsafe impl Plain for MsgEnt {}

Expand Down
1 change: 1 addition & 0 deletions tests/kexpr.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,6 @@ def busdev_kexpr2addr(bus, device, kexpr):
elif plat_dev:
busdev_kexpr2addr("platform", plat_dev, kexpr)
else:
print(f"Invalid arguments {args}")
exit(1)

0 comments on commit e4b14aa

Please sign in to comment.