Skip to content

Commit

Permalink
test: refactor ci and run test as different job
Browse files Browse the repository at this point in the history
  • Loading branch information
kumarak committed Sep 3, 2024
1 parent ba0df91 commit 1bdb76b
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 7 deletions.
7 changes: 7 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,16 @@ RUN apt-get update && \
apt-get clean --yes && \
rm -rf /var/lib/apt/lists/*

# Install Docker
RUN curl -fsSL https://get.docker.com -o get-docker.sh \
&& sh get-docker.sh \
&& rm get-docker.sh

RUN apt-get -y purge llvm-14 clang-14

RUN pip3 install lit codespell jinja2 Pygments

COPY ./install-llvm.sh /tmp/
RUN chmod +x /tmp/install-llvm.sh && /tmp/install-llvm.sh ${LLVM_VERSION} all

RUN groupadd docker || true && usermod -aG docker root
15 changes: 11 additions & 4 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
"name": "C++",
// to run local build of devcontainer
"build": { "dockerfile": "./Dockerfile" },
"runArgs": ["--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined"],

"runArgs": ["--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined", "--privileged"],
"mounts": [
"source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind"
],
// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
Expand All @@ -18,10 +20,15 @@
}
},

"remoteUser": "vscode",
"remoteUser": "root",
"features": {
"git": "os-provided",
"python": "os-provided"
"python": "os-provided",
"ghcr.io/devcontainers/features/docker-in-docker:2": {
"version": "latest",
"moby": true,
"dockerDashComposeVersion": "v2"
}
},
"containerEnv": {
"CMAKE_PREFIX_PATH": "/usr/lib/llvm-18/lib/cmake/mlir/;/usr/lib/llvm-18/lib/cmake/clang/",
Expand Down
58 changes: 56 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,59 @@ jobs:
- name: Build ${{ matrix.build-type }} with sanitizers set ${{ matrix.sanitizers }}
run: cmake --build --preset ci --config ${{ matrix.build-type }} -j $(nproc)

- name: Test ${{ matrix.build-type }} with sanitizers set ${{ matrix.sanitizers }}
run: ctest --preset ci --build-config ${{ matrix.build-type }}
#- name: Test ${{ matrix.build-type }} with sanitizers set ${{ matrix.sanitizers }}
# run: |
# cmake --preset ci
# ctest --preset ci --build-config ${{ matrix.build-type }}
test:
needs: build
strategy:
matrix:
llvm-version: [18]
image-version: [22.04]
build-type: [Release, Debug]
sanitizers: [ON, OFF]
runs-on: ubuntu-${{ matrix.image-version }}
env:
CMAKE_PREFIX_PATH: "/usr/lib/llvm-${{ matrix.llvm-version }}/lib/cmake/mlir/;/usr/lib/llvm-${{ matrix.llvm-version }}/lib/cmake/clang/"
LLVM_EXTERNAL_LIT: "/usr/local/bin/lit"
ENABLE_SANITIZER_UNDEFINED_BEHAVIOR: ${{ matrix.sanitizers }}
ENABLE_SANITIZER_ADDRESS: ${{ matrix.sanitizers }}

steps:
- name: Clone the Patchestry repository
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 1

- name: Install CTest dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
software-properties-common \
ninja-build python3-pip \
ccache cmake lld lcov \
doxygen libzstd-dev
curl -fsSL https://get.docker.com -o get-docker.sh \
&& sh get-docker.sh \
&& rm get-docker.sh
sudo apt-get -y purge llvm-14 clang-14
pip3 install lit codespell jinja2 Pygments
curl -fsSL https://apt.llvm.org/llvm.sh -o llvm.sh && \
chmod +x llvm.sh && \
sudo ./llvm.sh ${{ matrix.llvm-version }} all && \
rm llvm.sh
sudo apt-get install libmlir-${{ matrix.llvm-version }}-dev mlir-${{ matrix.llvm-version }}-tools
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-${{ matrix.llvm-version }} 60
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/clang-${{ matrix.llvm-version }} 60
sudo ln -s /usr/bin/FileCheck-${{ matrix.llvm-version }} /usr/bin/FileCheck
- name: Run CTest
run: |
cmake --preset ci
ctest --preset ci --build-config ${{ matrix.build-type }}
2 changes: 1 addition & 1 deletion scripts/ghidra/decompile-headless.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ docker run --rm \
-v $INPUT_PATH:/input \
-v $OUTPUT_PATH:/output \
trailofbits/patchestry-decompilation:latest \
/input $FUNCTION_NAME /output
/input $FUNCTION_NAME /output

0 comments on commit 1bdb76b

Please sign in to comment.