Merge #221 221: Add the `Syscalls` trait to `libtock_platform`. r=hudson-ayers a=jrvanwhy `Syscalls` is a trait representing Tock's system call API. It will be implemented by both `libtock_runtime` (included by TBF binaries) and `libtock_fake` (included by unit tests). It will allow us to replace the real Tock kernel with a fake Tock kernel for testing purposes. `Syscalls` is designed to introduce no overhead over the system call assembly logic. For `allow`, `command`, and `subscribe`, it is based on Tock's `Driver` trait. A higher-level interface over Tock's system calls, for use by `libtock_core` and client code, will be introduced in a later PR. Co-authored-by: Johnathan Van Why <jrvanwhy@google.com>
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..744ea69 --- /dev/null +++ b/.github/workflows/ci.yml
@@ -0,0 +1,44 @@ +# This workflow provides automated testing. It builds and runs tests on each PR. + +name: ci +on: pull_request + +jobs: + ci: + # Using ubuntu-latest can cause breakage when ubuntu-latest is updated to + # point at a new Ubuntu version. Instead, explicitly specify the version, so + # we can update when we need to. This *could* break if we don't update it + # until support for 18.04 is dropped, but it is likely we'll have a reason + # to update to a newer Ubuntu before then anyway. + runs-on: ubuntu-18.04 + + steps: + # Clones a single commit from the libtock-rs repository. The commit cloned + # is a merge commit between the PR's target branch and the PR's source. + # Note that we checkout submodules so that we can invoke Tock's CI setup + # scripts, but we do not recursively checkout submodules as we need Tock's + # makefile to set up the qemu submodule itself. + - name: Clone repository + uses: actions/checkout@v2.3.0 + with: + submodules: true + + # Install a Rust toolchain with the components necessary to build + # libtock-rs and its examples. This action doesn't seem to be able to + # install toolchains for multiple targets, so I add the targets later in + # the "Build and Test" step. + - name: Install Rust toolchain + uses: actions-rs/toolchain@v1.0.6 + with: + profile: minimal + + # The main test step. We let the makefile do most of the work because the + # makefile can be tested locally. We experimentally determined that -j2 is + # optimal for the Azure Standard_DS2_v2 VM, which is the VM type used by + # GitHub Actions at the time of this writing. + - name: Build and Test + run: | + cd "${GITHUB_WORKSPACE}" + rustup target add riscv32imc-unknown-none-elf thumbv7em-none-eabi + make -j2 setup + make -j2 test