Skip to content

Commit 8b22550

Browse files
committed
[pcode] refactor lifting scripts that use the Ghidra API for testability and maintainability, add tests and test environment, and add them into CI
1 parent 295132b commit 8b22550

43 files changed

Lines changed: 5622 additions & 2949 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,47 @@
11
#
2-
# Copyright (c) 2024, Trail of Bits, Inc.
2+
# Copyright (c) 2025, Trail of Bits, Inc.
33
#
44
# This source code is licensed in accordance with the terms specified in
55
# the LICENSE file found in the root directory of this source tree.
66
#
77

8-
name: Build
9-
8+
name: CI
109
on:
1110
push:
1211
branches:
1312
- 'main'
14-
1513
tags:
1614
- '*'
17-
1815
pull_request:
1916
branches:
2017
- '*'
2118

2219
jobs:
23-
build:
20+
llvm-build-and-test:
2421
strategy:
2522
matrix:
2623
llvm-version: [20]
2724
image-version: [22.04]
2825
build-type: [Release, Debug]
2926
sanitizers: [OFF]
30-
3127
runs-on: ubuntu-${{ matrix.image-version }}
32-
timeout-minutes: 90
28+
timeout-minutes: 30
3329
container:
3430
image:
3531
ghcr.io/lifting-bits/patchestry-ubuntu-${{ matrix.image-version }}-llvm-${{ matrix.llvm-version }}-dev:latest
36-
3732
services:
3833
docker:
3934
image: docker:20.10-dind
4035
options: --privileged
4136
ports:
42-
- 2375:2375
43-
37+
- 12375:2375
4438
env:
4539
CMAKE_PREFIX_PATH: "/usr/lib/llvm-${{ matrix.llvm-version }}/lib/cmake/mlir/;/usr/lib/llvm-${{ matrix.llvm-version }}/lib/cmake/clang/"
4640
LLVM_EXTERNAL_LIT: "/usr/local/bin/lit"
4741
ENABLE_SANITIZER_UNDEFINED_BEHAVIOR: ${{ matrix.sanitizers }}
4842
ENABLE_SANITIZER_ADDRESS: ${{ matrix.sanitizers }}
4943
CI: true
50-
5144
steps:
52-
- name: Clean Docker to prevent space issues
53-
run: |
54-
docker system prune -af --volumes || true
55-
5645
- name: Clone the Patchestry repository
5746
uses: actions/checkout@v4
5847
with:
@@ -63,14 +52,32 @@ jobs:
6352
run: cmake --preset ci -DPE_USE_VENDORED_Z3=OFF -DLLVM_EXTERNAL_LIT=$(which lit) -DLLVM_Z3_INSTALL_DIR=/usr/local
6453

6554
- name: Build ${{ matrix.build-type }} with sanitizers set ${{ matrix.sanitizers }}
66-
run: cmake --build --preset ci --config ${{ matrix.build-type }} -j $(nproc)
55+
run: cmake --build --preset ci --config ${{ matrix.build-type }} -j$(nproc)
6756

68-
- name: Build the headless docker image
57+
- name: Build the headless decompilation docker image
6958
run: |
70-
# Free more space before building Docker image
71-
docker system prune -af --volumes || true
7259
bash ./scripts/ghidra/build-headless-docker.sh
7360
7461
- name: Test ${{ matrix.build-type }} with sanitizers set ${{ matrix.sanitizers }}
7562
run: |
7663
lit ./builds/ci/test -D BUILD_TYPE=${{ matrix.build-type }} -v -DCI_OUTPUT_FOLDER=${{ github.workspace }}/builds/ci/test/ghidra/Output
64+
65+
ghidra-script-tests:
66+
strategy:
67+
matrix:
68+
image-version: [22.04]
69+
runs-on: ubuntu-${{ matrix.image-version }}
70+
timeout-minutes: 30
71+
env:
72+
CI: true
73+
steps:
74+
- name: Clone the Patchestry repository
75+
uses: actions/checkout@v4
76+
with:
77+
submodules: true
78+
fetch-depth: 1
79+
80+
- name: Build the Ghidra testing Docker image and run tests via Gradle
81+
run: |
82+
DOCKER_BUILDKIT=1 docker build -t trailofbits/decompile-test:latest -f test/decompile-test.dockerfile . && \
83+
docker run trailofbits/decompile-test

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.z3*
12
**/.DS_Store
23
.idea/
34
.vs/

0 commit comments

Comments
 (0)