File tree 5 files changed +78
-0
lines changed 5 files changed +78
-0
lines changed Original file line number Diff line number Diff line change @@ -349,3 +349,24 @@ jobs:
349
349
- uses : actions/checkout@v2
350
350
- name : Check for unused irep ids
351
351
run : ./scripts/string_table_check.sh
352
+
353
+ check-docker-image :
354
+ runs-on : ubuntu-20.04
355
+ steps :
356
+ - uses : actions/checkout@v2
357
+ with :
358
+ submodules : recursive
359
+ - name : Download test dependencies
360
+ run : sudo apt install openjdk-11-jdk-headless
361
+ - name : Build docker image
362
+ run : docker build -t cbmc .
363
+ - name : Smoke test goto-cc
364
+ run : docker run -v ${PWD}/.github/workflows/smoke_test_assets:/mnt/smoke -t cbmc goto-cc -o /mnt/smoke/test.goto /mnt/smoke/test.c
365
+ - name : Smoke test cbmc
366
+ run : docker run -v ${PWD}/.github/workflows/smoke_test_assets:/mnt/smoke -t cbmc cbmc /mnt/smoke/test.goto
367
+ - name : Smoke test jbmc
368
+ run : |
369
+ javac .github/workflows/smoke_test_assets/Test.java
370
+ docker run -v ${PWD}/.github/workflows/smoke_test_assets:/mnt/smoke -t cbmc jbmc --classpath /mnt/smoke Test
371
+ - name : Smoke test goto-analyzer
372
+ run : docker run -v ${PWD}/.github/workflows/smoke_test_assets:/mnt/smoke -t cbmc goto-analyzer /mnt/smoke/test.goto --unreachable-functions
Original file line number Diff line number Diff line change
1
+ public class Test {
2
+ public static void main (String [] args ) {
3
+ System .out .println ("Hi" );
4
+ assert (1 == 1 );
5
+ }
6
+ }
Original file line number Diff line number Diff line change
1
+ #include <assert.h>
2
+
3
+ #define return_val 0;
4
+
5
+ int main (void )
6
+ {
7
+ assert (1 == 1 );
8
+ return return_val ;
9
+ }
Original file line number Diff line number Diff line change @@ -301,6 +301,21 @@ the need to integrate JBMC as a separate project. Be aware that you need to
301
301
change the build location (Select project in Eclipse -> Properties -> C/C++
302
302
Build) to one of the src directories.
303
303
304
+ # WORKING WITH DOCKER
305
+
306
+ To compile and run the tools in a Docker container, do the following:
307
+
308
+ 1. From the root folder of the project, run `$ docker build -t cbmc .`
309
+ 2. After the building phase has finished, there should be a new
310
+ image with the CProver binaries installed under `/usr/local/bin/`.
311
+
312
+ To start a container using that image as a base, run `$ docker run -i -t cbmc`
313
+ This will result in dropping you to a new terminal inside the container. To
314
+ load files for analysis into the container, one way is by mounting the folder
315
+ that contains the tests to the container. A possible invocation that does that
316
+ is: `$ docker run --mount type=bind,source=local/path/with/files,target=/mnt/analysis -i t cbmc`. In the
317
+ resulting container, the files present in the local file system under
318
+ `local/path/with/files` will be present under `/mnt/analysis`.
304
319
305
320
# OPTIONS AND VARIABLES
306
321
Original file line number Diff line number Diff line change
1
+ FROM ubuntu:20.04 as builder
2
+ ENV DEBIAN_FRONTEND noninteractive
3
+ ENV DEBCONF_NONINTERACTIVE_SEEN true
4
+ # Timezone data is needed during the installation of dependencies,
5
+ # since cmake depends on the tzdata package. In an interactive terminal,
6
+ # the user selects the timezone at installation time. Since this needs
7
+ # to be a non-interactive terminal, we need to setup some sort of default.
8
+ # The UTC one seemed the most suitable one.
9
+ RUN echo 'tzdata tzdata/Areas select Etc' | debconf-set-selections; \
10
+ echo 'tzdata tzdata/Zones/Etc select UTC' | debconf-set-selections; \
11
+ apt-get update && apt-get upgrade -y && apt-get install --no-install-recommends -y \
12
+ cmake \
13
+ ninja-build \
14
+ gcc \
15
+ g++ \
16
+ maven \
17
+ flex \
18
+ bison \
19
+ libxml2-utils \
20
+ patch
21
+ COPY . /tmp/cbmc
22
+ WORKDIR /tmp/cbmc
23
+ RUN cmake -S . -Bbuild -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/g++ && cd build; ninja -j2
24
+
25
+ FROM ubuntu:20.04 as runner
26
+ COPY --from=builder /tmp/cbmc/build/bin/* /usr/local/bin/
27
+ RUN apt-get update && apt-get install -y gcc
You can’t perform that action at this time.
0 commit comments