-
Notifications
You must be signed in to change notification settings - Fork 715
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Dockerfiles to run tests against different clang versions
- Loading branch information
1 parent
7e90434
commit c28485d
Showing
3 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
ARG LLVM_VERSION=13 | ||
|
||
FROM clang:${LLVM_VERSION}-ubuntu | ||
|
||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly | ||
|
||
COPY . /project | ||
WORKDIR /project | ||
|
||
CMD ["/root/.cargo/bin/cargo", "test", "-p", "bindgen-tests", "--features", "__testing_only_extra_assertions"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
FROM ubuntu:jammy | ||
|
||
ENV DEBIAN_FRONTEND noninteractive | ||
|
||
ARG LLVM_VERSION=13 | ||
|
||
RUN apt-get update && apt-get install -y \ | ||
wget \ | ||
curl \ | ||
gnupg \ | ||
build-essential \ | ||
&& wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | gpg --dearmor | tee /usr/share/keyrings/llvm-archive-keyring.gpg > /dev/null \ | ||
&& echo "deb [signed-by=/usr/share/keyrings/llvm-archive-keyring.gpg] https://apt.llvm.org/jammy/ llvm-toolchain-jammy-${LLVM_VERSION} main" > /etc/apt/sources.list.d/llvm.list \ | ||
&& apt-get update && apt-get install -y \ | ||
clang-${LLVM_VERSION} \ | ||
libclang-${LLVM_VERSION}-dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Dockerfiles for running cargo test on bindgen-tests | ||
|
||
## Dockerfile-clang | ||
|
||
LLVM_VERSION can be [13, 18] and correspond to the packages at [apt.llvm.org](https://apt.llvm.org/) for Ubuntu 22.04 | ||
|
||
From the `rust-bingen` repo, | ||
|
||
``` | ||
docker build dockerfiles -f dockerfiles/Dockerfile-clang -t clang:14-ubuntu --build-arg LLVM_VERSION=14 | ||
``` | ||
|
||
## Dockerfile-bindgen | ||
|
||
From the `rust-bindgen` repo, | ||
|
||
``` | ||
docker build . -f dockerfiles/Dockerfile-bindgen -t bindgen:clang-14-ubuntu --build-arg LLVM_VERSION=14 | ||
``` | ||
|
||
## Make changes to the repo happen in the docker container | ||
|
||
``` | ||
docker run -v .:/project bindgen:clang-14-ubuntu | ||
``` | ||
|
||
To pass an environment variable to the container | ||
|
||
``` | ||
docker run -v .:/project -e BINDGEN_OVERWRITE_EXPECTED=1 bindgen:clang-14-ubuntu | ||
``` |