|
|
TODO
|
|
|
|
|
|
## Tests
|
|
|
|
|
|
```
|
|
|
make tests
|
|
|
```
|
|
|
|
|
|
To run a subset of tests e.g. 0:Parser
|
|
|
```
|
|
|
make && dune exec --profile release -- tests/main.exe -list-test
|
|
|
make && dune exec --profile release -- tests/main.exe -only-test 0:Parser
|
|
|
```
|
|
|
|
|
|
### Fuzzing-based tests
|
|
|
|
|
|
1. Setup
|
|
|
```bash
|
|
|
sudo apt install afl++
|
|
|
opam switch create 4.12.0+afl --package=ocaml-variants.4.12.0+options,ocaml-option-afl
|
|
|
opam switch 4.12.0+afl
|
|
|
eval $(opam env)
|
|
|
opam install --yes . --deps-only
|
|
|
opam install crowbar bun
|
|
|
```
|
|
|
2. Run tests
|
|
|
```bash
|
|
|
make fuzz
|
|
|
or
|
|
|
make ci-fuzz or make ci-fuzz-timeout (to find more than one bug at at time)
|
|
|
```
|
|
|
replay crashes
|
|
|
```bash
|
|
|
make replay-fuzz /tmp/findings/XX/crashes/YYY
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
More about fuzzing
|
|
|
|
|
|
* https://blog.regehr.org/archives/1687
|
|
|
* https://somerandomidiot.com/blog/2017/04/26/crowbar-dhcp/
|
|
|
* https://tarides.com/blog/2019-09-04-an-introduction-to-fuzzing-ocaml-with-afl-crowbar-and-bun/
|
|
|
|
|
|
## Packaging for OPAM
|
|
|
```
|
|
|
Update the CHANGES.md add new version X.Y.Z
|
|
|
dune-release tag vX.Y.Z
|
|
|
make opam-release
|
|
|
dune-release publish
|
|
|
```
|
|
|
|
|
|
## Register a runner for Gitlab (using docker compose)
|
|
|
```bash
|
|
|
#https://techoverflow.net/2021/01/12/how-to-install-gitlab-runner-using-docker-compose/
|
|
|
# executor: docker
|
|
|
# default image: alpine:3.14
|
|
|
# tags: empty
|
|
|
```
|
|
|
|
|
|
```yaml
|
|
|
version: '3'
|
|
|
services:
|
|
|
minio:
|
|
|
image: minio/minio:latest
|
|
|
expose:
|
|
|
- "9000"
|
|
|
# environment:
|
|
|
# MINIO_ROOT_USER: minioadmin
|
|
|
# MINIO_ROOT_PASSWORD: minioadmin
|
|
|
healthcheck:
|
|
|
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
|
|
|
interval: 30s
|
|
|
timeout: 20s
|
|
|
retries: 3
|
|
|
|
|
|
volumes:
|
|
|
- ./minio:/root/.minio
|
|
|
- ./minio/export:/export
|
|
|
restart: unless-stopped
|
|
|
command: server --address 0.0.0.0:9000 /export
|
|
|
gitlab-runner:
|
|
|
image: 'gitlab/gitlab-runner:latest'
|
|
|
volumes:
|
|
|
- /var/run/docker.sock:/var/run/docker.sock
|
|
|
- ./config:/etc/gitlab-runner
|
|
|
restart: unless-stopped
|
|
|
depends_on:
|
|
|
- minio
|
|
|
healthcheck:
|
|
|
test: ["CMD", "curl", "-f", "http://minio:9000/minio/health/live"]
|
|
|
interval: 30s
|
|
|
timeout: 20s
|
|
|
retries: 3
|
|
|
```
|
|
|
|
|
|
config.toml
|
|
|
```toml
|
|
|
concurrent = 5
|
|
|
limit = 5
|
|
|
check_interval = 0
|
|
|
|
|
|
[session_server]
|
|
|
session_timeout = 1800
|
|
|
|
|
|
[[runners]]
|
|
|
name = "PIMS"
|
|
|
url = "https://gitlab.lip6.fr/"
|
|
|
token = "<TOKEN>"
|
|
|
executor = "docker"
|
|
|
output_limit = "32768" #in KB-> 32MB
|
|
|
[runners.custom_build_dir]
|
|
|
[runners.cache]
|
|
|
Type = "s3"
|
|
|
Path = "mycustom-s3"
|
|
|
Shared = true
|
|
|
[runners.cache.s3]
|
|
|
ServerAddress = "minio:9005"
|
|
|
AccessKey = "minioadmin"
|
|
|
SecretKey = "minioadmin"
|
|
|
BucketName = "runner"
|
|
|
Insecure = true
|
|
|
[runners.docker]
|
|
|
tls_verify = false
|
|
|
image = "alpine:3.14"
|
|
|
privileged = false
|
|
|
disable_entrypoint_overwrite = false
|
|
|
oom_kill_disable = false
|
|
|
disable_cache = false
|
|
|
volumes = ["/cache"]
|
|
|
shm_size = 0
|
|
|
```
|
|
|
|
|
|
Debugging locally
|
|
|
|
|
|
1. Install gitlab-runner (could be done in vagrant)
|
|
|
```bash
|
|
|
curl -LJO "https://gitlab-runner-downloads.s3.amazonaws.com/latest/deb/gitlab-runner_amd64.deb"
|
|
|
dpkg -i gitlab-runner_amd64.deb
|
|
|
|
|
|
|
|
|
or
|
|
|
|
|
|
curl -L "https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.deb.sh" | sudo bash
|
|
|
sudo apt-get install gitlab-runner
|
|
|
```
|
|
|
1. Run locally the ci $build$ job
|
|
|
```bash
|
|
|
cd git repo
|
|
|
gitlab-runner exec shell build
|
|
|
or
|
|
|
gitlab-runner exec docker build
|
|
|
```
|
|
|
|
|
|
Tips to debug add sleep to have the time to debug the container using a docker exec -it CONTAINER bash
|
|
|
|