Debian Codegraph @

Dockerfiles/test_suite

raw
1 # This Dockerfile should allow you to run the openscap test suite
2 # inside a Fedora container and it can be also used to test a specific
3 # pull request (PR).
4 #
5 # Example how to build it and run it:
6 # podman build -t oscap_test_suite -f Dockerfiles/test_suite
7 # podman run --cap-add=SYS_PTRACE -e PR=ID --name pr_test oscap_test_suite
8 #
9 # where ID in the $PR environment variable is the pull request (PR) ID,
10 # if ID would not be set (-e option omitted) tests will be run from the
11 # default branch (main).
12 #
13 # Once tests are finished it is possible to enter the container:
14 # podman start pr_test
15 # podman exec -it pr_test bash
16 # and when you are done with the container you can remove it:
17 # podman rm -f pr_test
18 #
19 FROM fedora
20
21 RUN dnf -y update && \
22 dnf -y install \
23 git-extras git cmake dbus-devel GConf2-devel \
24 libacl-devel libblkid-devel libcap-devel libcurl-devel \
25 libgcrypt-devel libselinux-devel libxml2-devel libxslt-devel \
26 libattr-devel make openldap-devel pcre-devel \
27 perl-XML-Parser perl-XML-XPath perl-devel \
28 python3-devel rpm-devel swig bzip2-devel \
29 gcc-c++ libyaml-devel xmlsec1-devel xmlsec1-openssl-devel \
30 hostname bzip2 lua rpm-build which strace \
31 && dnf clean all \
32 && rm -rf /var/cache/dnf
33
34 RUN git clone --recurse-submodules https://github.com/OpenSCAP/openscap
35 RUN echo -e "#!/bin/bash\n\ncd /openscap/build\nif [ -d /openscap/build/tests ]; then\n sleep 1d\n exit 0\nelse\n [ -n \"\$PR\" ] && git pr \$PR\n echo \"Testing branch: \$(git branch --show-current)\"\n cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ../ && make all\n ctest --output-on-failure\nfi" >> /run.sh
36 RUN chmod +x /run.sh
37
38 CMD /bin/bash -c /run.sh; /bin/bash