Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up the test and its use in CI #137

Merged
merged 9 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ freebsd_task:
- opam install -t ocaml-solo5 --deps-only
build_script: opam reinstall -t ocaml-solo5
test_script:
- MODE=hvt opam exec -- dune build --root test
- MODE=hvt opam exec -- dune build --root example
45 changes: 15 additions & 30 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,8 @@ jobs:
strategy:
matrix:
operating-system: [ubuntu-latest]
ocaml-version: [4.13.1]
mode:
- name: hvt
exec: false
- name: spt
exec: true
- name: virtio
exec: false
- name: muen
exec: false
- name: xen
exec: false
include:
- operating-system: ubuntu-latest
ocaml-version: 4.13.0
mode:
name: spt
exec: true
- operating-system: ubuntu-latest
ocaml-version: 4.12.1
mode:
name: spt
exec: true
name: ${{ matrix.mode.name }} / ${{ matrix.ocaml-version }}
ocaml-version: [4.12.1,4.13.1,4.14.1]
name: OCaml ${{ matrix.ocaml-version }}
runs-on: ${{ matrix.operating-system }}
steps:
- uses: actions/checkout@v2
Expand All @@ -37,12 +15,19 @@ jobs:
ocaml-compiler: ${{ matrix.ocaml-version }}
opam-local-packages: |
!ocaml-solo5-cross-aarch64.opam
- name: Pinning package
- name: Pin package
run: opam pin add -n -t -y ocaml-solo5 .
- name: Install ocaml-solo5 and dune
run: opam depext -iyt ocaml-solo5 conf-libseccomp dune
- name: Compiling example project
run: MODE=${{ matrix.mode.name }} opam exec -- dune build --root test
- name: Running example project
if: ${{ matrix.mode.exec }}
run: opam exec -- solo5-${{ matrix.mode.name }} test/_build/solo5/main.exe || [ $? -eq 1 ]
- name: Compile example with hvt
run: MODE=hvt opam exec -- dune build --root example
- name: Compile example with spt
run: MODE=spt opam exec -- dune build --root example
- name: Run example with spt
run: opam exec -- solo5-spt example/_build/solo5/main.exe
- name: Compile example with virtio
run: MODE=virtio opam exec -- dune build --root example
- name: Compile example with muen
run: MODE=muen opam exec -- dune build --root example
- name: Compile example with xen
run: MODE=xen opam exec -- dune build --root example
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,16 @@ ocamlfind or dune:

#### Example

The `example` describes the minimal structure needed to build an
ocaml-solo5 executable with dune, linked with the hvt bindings. It
requires an application manifest and a startup file to initialize the libc.
The `example` describes the minimal structure needed to build an ocaml-solo5
executable with dune, linked with the hvt bindings by default. It requires an
application manifest and a startup file to initialize the libc.

Build: `dune build -x solo5`
Run: `solo5-hvt _build/default.solo5/main.exe`
Run: `solo5-hvt _build/solo5/main.exe`

## Supported compiler versions

Tested against OCaml 4.12.1 through 4.13.0. Other versions may require
Tested against OCaml 4.12.1 through 4.14.1. Other versions may require
changing `configure.sh`.

## Porting to a different (uni)kernel base layer
Expand Down
11 changes: 9 additions & 2 deletions example/dune
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(executable
(name main)
(link_flags -cclib "-z solo5-abi=hvt")
(link_flags :standard -cclib "-z solo5-abi=%{env:MODE=hvt}")
(foreign_stubs
(language c)
(names startup manifest)))
Expand All @@ -11,9 +11,16 @@
(action
(run solo5-elftool gen-manifest manifest.json manifest.c)))

(rule
(alias runtest)
(enabled_if
(= %{context_name} solo5))
(action
(run "solo5-%{env:MODE=hvt}" "%{dep:main.exe}")))

(alias
(name default)
(enabled_if
(= %{context_name} default.solo5))
(= %{context_name} solo5))
(deps
(alias_rec all)))
2 changes: 1 addition & 1 deletion example/dune-project
Original file line number Diff line number Diff line change
@@ -1 +1 @@
(lang dune 2.8)
(lang dune 2.7)
9 changes: 9 additions & 0 deletions example/dune-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
(lang dune 2.0)

(context (default))

(context
(default
(name solo5)
(toolchain solo5)
(host default)))
2 changes: 1 addition & 1 deletion example/main.ml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
let () = Printf.printf "\nHello from solo5!\n\n"
let () = Printf.printf "Hello from OCaml on Solo5!\n%!";;
6 changes: 3 additions & 3 deletions example/manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"type": "solo5.manifest",
"version": 1,
"devices": []
"type": "solo5.manifest",
"version": 1,
"devices": []
}
1 change: 1 addition & 0 deletions example/startup.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ void _nolibc_init(uintptr_t heap_start, size_t heap_size); // defined in nolibc/
int solo5_app_main(const struct solo5_start_info *si) {
_nolibc_init(si->heap_start, si->heap_size);
caml_startup(unused_argv);
return 0;
}
57 changes: 0 additions & 57 deletions test/dune

This file was deleted.

1 change: 0 additions & 1 deletion test/dune-project

This file was deleted.

9 changes: 0 additions & 9 deletions test/dune-workspace

This file was deleted.

1 change: 0 additions & 1 deletion test/main.ml

This file was deleted.

5 changes: 0 additions & 5 deletions test/manifest.json

This file was deleted.

16 changes: 0 additions & 16 deletions test/startup.c

This file was deleted.

Loading