Skip to content

Commit

Permalink
Remove framac, vera and rats as it's deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
diegorodriguez31 committed Jul 31, 2023
1 parent b710022 commit e765326
Show file tree
Hide file tree
Showing 21 changed files with 59 additions and 1,434 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ on:

# Variables to configure the workflow
env:
DOCKERFILE_PATH: '.'
DOCKERFILE_FILENAME: 'Dockerfile'
DOCKER_IMAGE_NAME: 'lequal/sonar-scanner'
DOCKERFILE_PATH: "."
DOCKERFILE_FILENAME: "Dockerfile"
DOCKER_IMAGE_NAME: "lequal/sonar-scanner"

jobs:
# Job to test if a new version is ready to be released
Expand Down
55 changes: 3 additions & 52 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,9 @@ RUN echo 'deb http://ftp.fr.debian.org/debian/ bullseye main contrib non-free' >
libpcre3-dev=2:8.39-* \
unzip=6.0-* \
xz-utils=5.2.5-* \
# for Frama-C
opam=2.0.8-* \
m4=1.4.18-* \
ocaml-findlib=1.8.1-* \
libfindlib-ocaml-dev=1.8.1-* \
libocamlgraph-ocaml-dev=1.8.8-* \
menhir=20201216-* \
ca-certificates

# Configure Opam for Frama-C
RUN opam init -y --disable-sandboxing \
&& eval $(opam env)
RUN opam install -y depext \
&& opam depext -y frama-c \
&& opam install -y --deps-only frama-c
ENV PATH="/root/.opam/default/bin:$PATH"

# sonar-scanner
RUN curl -ksSLO https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.8.0.2856-linux.zip \

# sonar-scanner
RUN curl -ksSLO https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.8.0.2856-linux.zip \
&& unzip sonar-scanner-cli-4.8.0.2856-linux.zip \
&& mv /sonar-scanner-4.8.0.2856-linux /sonar-scanner

Expand All @@ -44,31 +28,6 @@ RUN curl -ksSLO https://github.com/danmar/cppcheck/archive/refs/tags/2.10.tar.gz
HAVE_RULES="yes" \
CXXFLAGS="-O2 -DNDEBUG -Wall -Wno-sign-compare -Wno-unused-function -Wno-deprecated-declarations"

# RATS (and expat)
RUN curl -ksSLO https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/rough-auditing-tool-for-security/rats-2.4.tgz
RUN curl -ksSLO https://github.com/libexpat/libexpat/releases/download/R_2_0_1/expat-2.0.1.tar.gz \
&& tar -xvzf expat-2.0.1.tar.gz \
&& cd expat-2.0.1 \
&& ./configure \
&& make \
&& make install \
&& cd .. \
&& tar -xzvf rats-2.4.tgz \
&& cd rats-2.4 \
&& ./configure --with-expat-lib=/usr/local/lib \
&& make \
&& make install \
&& ./rats \
&& cd ..

# Frama-C
RUN curl -ksSLO https://frama-c.com/download/frama-c-26.1-Iron.tar.gz \
&& tar -zxvf frama-c-26.1-Iron.tar.gz \
&& cd frama-c-26.1-Iron \
&& opam exec -- make RELEASE=yes \
&& make install \
&& cd ..

# Infer
RUN curl -ksSLO https://github.com/facebook/infer/releases/download/v1.1.0/infer-linux64-v1.1.0.tar.xz \
&& tar -C /opt -Jxvf infer-linux64-v1.1.0.tar.xz
Expand Down Expand Up @@ -124,9 +83,6 @@ COPY --from=builder /usr/share/cppcheck /usr/share/cppcheck
COPY --from=builder /usr/bin/cppcheck /usr/bin
COPY --from=builder /usr/bin/cppcheck-htmlreport /usr/bin

# Add RATS and Frama-C from builder stage
COPY --from=builder /usr/local /usr/local

# Add Infer from builder stage
COPY --from=builder /opt/infer-linux64-v1.1.0/bin /opt/infer-linux64-v1.1.0/bin
COPY --from=builder /opt/infer-linux64-v1.1.0/lib /opt/infer-linux64-v1.1.0/lib
Expand All @@ -150,11 +106,6 @@ RUN echo 'deb http://ftp.fr.debian.org/debian/ bullseye main contrib non-free' >
python3-pip=20.3.4-* \
# Shellcheck
shellcheck=0.7.1-* \
# Needed by Frama-C
ocaml-findlib=1.8.1-* \
libocamlgraph-ocaml-dev=1.8.8-* \
libzarith-ocaml=1.11-* \
libyojson-ocaml=1.7.0-* \
# Needed by Infer
libsqlite3-0=3.34.1-* \
libtinfo5=6.2* \
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,6 @@ sonar-scanning:
| [pylint](http://pylint.pycqa.org/en/latest/user_guide/index.html) | 2.17.2 | pylint-report.txt |
| [CNES pylint extension](https://github.com/cnescatlab/cnes-pylint-extension) | 6.0.0 | |
| [CppCheck](https://github.com/danmar/cppcheck) | 2.10 | cppcheck-report.xml |
| [RATS](https://code.google.com/archive/p/rough-auditing-tool-for-security/) | 2.4 | rats-report.xml |
| [Frama-C](https://frama-c.com/index.html) | 26.1-Iron | |
| [Infer](https://fbinfer.com/) | 1.1.0 | |

## Developer's guide
Expand Down
120 changes: 52 additions & 68 deletions tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,56 +5,38 @@ The `tests/` folder contains both tests and some dummy projects to analyze.
## List of integration tests

1. Java
* function: test_language_java
* purpose: Check that the Java language is supported and that the right plugins are executed.
- function: test_language_java
- purpose: Check that the Java language is supported and that the right plugins are executed.
1. Shell
* function: test_language_shell
* purpose: Check that the Shell language is supported and that the right plugins are executed.
- function: test_language_shell
- purpose: Check that the Shell language is supported and that the right plugins are executed.
1. ShellCheck
* function: test_tool_shellcheck
* purpose: Check that ShellCheck can be launched from within the container to analyze scripts in the project.
- function: test_tool_shellcheck
- purpose: Check that ShellCheck can be launched from within the container to analyze scripts in the project.
1. Fortran
* functions: test_language_fortran_77 and test_language_fortran_90
* purpose: Check that the Fortran 77 and 90 languages are supported and that the right plugins are executed.
- functions: test_language_fortran_77 and test_language_fortran_90
- purpose: Check that the Fortran 77 and 90 languages are supported and that the right plugins are executed.
1. Python
* function: test_language_python
* purpose: Check that the Python language is supported and that CNES Quality Profiles are usable.
- function: test_language_python
- purpose: Check that the Python language is supported and that CNES Quality Profiles are usable.
1. Pylint
* function: test_tool_pylint
* purpose: Check that Pylint can be launched from within the container to analyze Python projects.
- function: test_tool_pylint
- purpose: Check that Pylint can be launched from within the container to analyze Python projects.
1. Import pylint results in SonarQube
* function: test_import_pylint_results
* purpose: Check that issues revealed by a pylint analysis can be imported in SonarQube.
- function: test_import_pylint_results
- purpose: Check that issues revealed by a pylint analysis can be imported in SonarQube.
1. C/C++
* function: test_language_c_cpp
* purpose: Check that the C and C++ languages are supported and that CNES Quality Profiles are usable.
- function: test_language_c_cpp
- purpose: Check that the C and C++ languages are supported and that CNES Quality Profiles are usable.
1. CppCheck
* function: test_tool_cppcheck
* purpose: Check that cppcheck can be launched from within the container to analyze C/C++ projects.
- function: test_tool_cppcheck
- purpose: Check that cppcheck can be launched from within the container to analyze C/C++ projects.
1. Import CppCheck results
* function: test_import_cppcheck_results
* purpose: Check that issues revealed by a cppcheck analysis can be imported in SonarQube.
1. Vera++
* function: test_tool_vera
* purpose: Check that vera++ can be launched from within the container to analyze C/C++ projects.
1. Import Vera++ results
* function: test_import_vera_results
* purpose: Check that issues revealed by vera++ and activated in the Quality Profile can be imported in SonarQube.
1. RATS
* function: test_tool_rats
* purpose: Check that RATS can be launched from within the container to analyze C/C++ projects.
1. Import RATS results
* function: test_import_rats_results
* purpose: Check that issues revealed by RATS and activated in the Quality Profile can be imported in SonarQube.
1. Frama-C
* function: test_tool_framac
* purpose: Check that Frama-C can be launched from within the container to analyze C/C++ projects.
1. Import Frama-C results
* function: test_import_framac_results
* purpose: Check that issues revealed by Frama-C and activated in the Quality Profile can be imported in SonarQube.
- function: test_import_cppcheck_results
- purpose: Check that issues revealed by a cppcheck analysis can be imported in SonarQube.
1. Infer
* function: test_tool_infer
* purpose: Check that Infer can be launched from within the container to analyze C/C++ projects.
- function: test_tool_infer
- purpose: Check that Infer can be launched from within the container to analyze C/C++ projects.

### How to run all the tests

Expand All @@ -80,36 +62,38 @@ $ pip install -r requirements.txt

1. Activate the virtual environment (if any)
1. Create a docker bridge
* ```sh
$ docker network create sonarbridge
```
- ```sh
$ docker network create sonarbridge
```
1. Run a container of the SonarQube server
* ```sh
$ docker run --name lequalsonarqube \
-d --rm \
-p 9000:9000 \
-e SONARQUBE_ADMIN_PASSWORD=adminpassword \
--net sonarbridge \
lequal/sonarqube:latest
```
* Wait until it is configured
* The message `[INFO] CNES SonarQube: ready!` is logged.
* To see the logs of a container running in background
```sh
$ docker container logs -f lequalsonarqube
Ctrl-C # once the container is ready
```
1. Run a specific test with `pytest` and specify some environment variables
- ```sh
$ docker run --name lequalsonarqube \
-d --rm \
-p 9000:9000 \
-e SONARQUBE_ADMIN_PASSWORD=adminpassword \
--net sonarbridge \
lequal/sonarqube:latest
```

- Wait until it is configured
- The message `[INFO] CNES SonarQube: ready!` is logged.
- To see the logs of a container running in background
```sh
$ RUN=no SONARQUBE_ADMIN_PASSWORD="adminpassword" pytest -k "<name of the test>"
$ docker container logs -f lequalsonarqube
Ctrl-C # once the container is ready
```

## List of environment variables used by the tests
1. Run a specific test with `pytest` and specify some environment variables
```sh
$ RUN=no SONARQUBE_ADMIN_PASSWORD="adminpassword" pytest -k "<name of the test>"
```

## List of environment variables used by the tests

* `RUN`: whether or not to run a lequal/sonarqube container and create a bridge network, default "yes", if you already have a running container, set it to "no" and provide information through the other variables.
* `SONARQUBE_CONTAINER_NAME`: the name to give to the container running the lequal/sonarqube image.
* `SONARQUBE_ADMIN_PASSWORD`: the password of the admin account on the server.
* `SONARQUBE_URL`: URL of lequal/sonarqube container if already running without trailing / from the scanner container. e.g. http://mycontainer:9000 Use it only if no container name was given.
* `SONARQUBE_LOCAL_URL`: URL of lequal/sonarqube container if already running without trailing / from the host. e.g. http://localhost:9000
* `SONARQUBE_TAG`: the tag of the lequal/sonarqube image to use. e.g. latest
* `SONARQUBE_NETWORK`: the name of the docker bridge used.
- `RUN`: whether or not to run a lequal/sonarqube container and create a bridge network, default "yes", if you already have a running container, set it to "no" and provide information through the other variables.
- `SONARQUBE_CONTAINER_NAME`: the name to give to the container running the lequal/sonarqube image.
- `SONARQUBE_ADMIN_PASSWORD`: the password of the admin account on the server.
- `SONARQUBE_URL`: URL of lequal/sonarqube container if already running without trailing / from the scanner container. e.g. http://mycontainer:9000 Use it only if no container name was given.
- `SONARQUBE_LOCAL_URL`: URL of lequal/sonarqube container if already running without trailing / from the host. e.g. http://localhost:9000
- `SONARQUBE_TAG`: the tag of the lequal/sonarqube image to use. e.g. latest
- `SONARQUBE_NETWORK`: the name of the docker bridge used.
1 change: 0 additions & 1 deletion tests/c_cpp/frama-c.csv

This file was deleted.

61 changes: 0 additions & 61 deletions tests/c_cpp/framac-results.out

This file was deleted.

Loading

0 comments on commit e765326

Please sign in to comment.