-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: move all tests to tests dir
- Loading branch information
Showing
108 changed files
with
74,452 additions
and
789 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,8 +8,7 @@ | |
**/*.dtb | ||
**/*.bin | ||
**/*.md | ||
|
||
**/Dockerfile* | ||
**/*.deb | ||
|
||
build | ||
third-party/downloads | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,5 @@ | ||
name: Build/Test/Release | ||
on: [push] | ||
env: | ||
KERNEL_VERSION: v0.19.1 | ||
LINUX_VERSION: 6.5.9-ctsi-1-v0.19.1 | ||
TOOLS_VERSION: v0.14.0 | ||
TEST_VERSION: v0.30.0 | ||
CARTESI_TESTS_PATH: /usr/share/cartesi-machine/tests | ||
CARTESI_IMAGES_PATH: /usr/share/cartesi-machine/images | ||
CARTESI_UARCH_PATH: /usr/share/cartesi-machine/uarch/uarch-ram.bin | ||
jobs: | ||
build: | ||
name: Build | ||
|
@@ -77,7 +69,7 @@ jobs: | |
token: ${{ secrets.DEPOT_TOKEN }} | ||
|
||
- name: Export deb package artifact (amd64) | ||
run: make copy BUILD_PLATFORM=linux/amd64 ARCH=amd64 DEBIAN_IMG=cartesi/machine-emulator:amd64_deb | ||
run: make copy BUILD_PLATFORM=linux/amd64 DEB_ARCH=amd64 DEBIAN_IMG=cartesi/machine-emulator:amd64_deb | ||
|
||
- name: Build debian package (arm64) | ||
uses: depot/build-push-action@v1 | ||
|
@@ -98,7 +90,7 @@ jobs: | |
token: ${{ secrets.DEPOT_TOKEN }} | ||
|
||
- name: Export deb package artifact (arm64) | ||
run: make copy BUILD_PLATFORM=linux/arm64 ARCH=arm64 DEBIAN_IMG=cartesi/machine-emulator:arm64_deb | ||
run: make copy BUILD_PLATFORM=linux/arm64 DEB_ARCH=arm64 DEBIAN_IMG=cartesi/machine-emulator:arm64_deb | ||
|
||
- name: Upload artifacts | ||
uses: actions/upload-artifact@master | ||
|
@@ -114,6 +106,7 @@ jobs: | |
test_amd64: | ||
name: Test (linux/amd64) | ||
needs: build | ||
if: false | ||
runs-on: ubuntu-latest-8-cores | ||
steps: | ||
- name: Checkout machine emulator source code | ||
|
@@ -140,15 +133,14 @@ jobs: | |
- name: Set up Depot CLI | ||
uses: depot/setup-action@v1 | ||
|
||
- name: Build docker image | ||
id: docker_build | ||
- name: Build machine-emulator "builder" docker image | ||
uses: depot/build-push-action@v1 | ||
with: | ||
file: Dockerfile | ||
context: . | ||
target: installer | ||
target: builder | ||
platforms: linux/amd64 | ||
tags: ${{ github.repository_owner }}/machine-emulator:devel | ||
tags: ${{ github.repository_owner }}/machine-emulator:builder | ||
push: false | ||
load: true | ||
cache-from: type=gha,scope=debian | ||
|
@@ -160,91 +152,93 @@ jobs: | |
project: ${{ vars.DEPOT_PROJECT }} | ||
token: ${{ secrets.DEPOT_TOKEN }} | ||
|
||
- name: Download [rootfs.ext2] | ||
uses: Legion2/[email protected] | ||
with: | ||
repository: ${{ github.repository_owner }}/machine-emulator-tools | ||
tag: ${{ env.TOOLS_VERSION }} | ||
file: rootfs-tools-${{ env.TOOLS_VERSION }}.ext2 | ||
|
||
- name: Download [kernel.bin] | ||
uses: Legion2/[email protected] | ||
- name: Build machine-emulator docker image | ||
uses: depot/build-push-action@v1 | ||
with: | ||
repository: ${{ github.repository_owner }}/image-kernel | ||
tag: ${{ env.KERNEL_VERSION }} | ||
file: linux-${{ env.LINUX_VERSION }}.bin | ||
|
||
- name: Move images to cartesi images folder | ||
run: | | ||
mkdir -m 755 -p ${{ env.CARTESI_IMAGES_PATH }} | ||
mv linux-*.bin rootfs-*.ext2 ${{ env.CARTESI_IMAGES_PATH }} | ||
cd ${{ env.CARTESI_IMAGES_PATH }} && ln -s linux-${{ env.LINUX_VERSION }}.bin linux.bin | ||
cd ${{ env.CARTESI_IMAGES_PATH }} && ln -s rootfs-tools-${{ env.TOOLS_VERSION }}.ext2 rootfs.ext2 | ||
file: Dockerfile | ||
context: . | ||
platforms: linux/amd64 | ||
tags: ${{ github.repository_owner }}/machine-emulator:devel | ||
push: false | ||
load: true | ||
cache-from: type=gha,scope=debian | ||
cache-to: type=gha,mode=max,scope=debian | ||
build-args: | | ||
RELEASE=${{ (startsWith(github.ref, 'refs/tags/v') && 'yes' || 'no') }} | ||
GIT_COMMIT=${GITHUB_SHA} | ||
MACHINE_EMULATOR_VERSION=${{ env.MACHINE_EMULATOR_VERSION }} | ||
project: ${{ vars.DEPOT_PROJECT }} | ||
token: ${{ secrets.DEPOT_TOKEN }} | ||
|
||
- name: Download test suite | ||
uses: Legion2/download-release-action@v2.1.0 | ||
- name: Build machine-emulator "tests" docker image | ||
uses: depot/build-push-action@v1 | ||
with: | ||
repository: ${{ github.repository_owner }}/machine-tests | ||
tag: ${{ env.TEST_VERSION }} | ||
file: machine-tests-${{ env.TEST_VERSION }}.tar.gz | ||
file: tests/Dockerfile | ||
context: . | ||
platforms: linux/amd64 | ||
tags: ${{ github.repository_owner }}/machine-emulator:tests | ||
push: false | ||
load: true | ||
cache-from: type=gha,scope=debian | ||
cache-to: type=gha,mode=max,scope=debian | ||
build-args: | | ||
MACHINE_EMULATOR_VERSION=${{ env.MACHINE_EMULATOR_VERSION }} | ||
project: ${{ vars.DEPOT_PROJECT }} | ||
token: ${{ secrets.DEPOT_TOKEN }} | ||
|
||
- name: Untar test suite | ||
run: mkdir -p ${{ env.CARTESI_TESTS_PATH }} && tar -xzf machine-tests-${{ env.TEST_VERSION }}.tar.gz -C ${{ env.CARTESI_TESTS_PATH }} | ||
|
||
- name: Simple boot inside the docker image | ||
run: docker run --rm -v ${{ env.CARTESI_IMAGES_PATH }}:${{ env.CARTESI_IMAGES_PATH }} -t ${{ github.repository_owner }}/machine-emulator:devel /usr/bin/cartesi-machine /bin/true | ||
run: docker run --rm -t ${{ github.repository_owner }}/machine-emulator:tests /usr/bin/cartesi-machine /bin/true | ||
|
||
- name: Run test suite inside the docker image | ||
run: docker run --rm -v ${{ env.CARTESI_TESTS_PATH }}:${{ env.CARTESI_TESTS_PATH }} -t ${{ github.repository_owner }}/machine-emulator:devel /usr/bin/cartesi-machine-tests --test-path=${{ env.CARTESI_TESTS_PATH }} run | ||
run: docker run --rm -t ${{ github.repository_owner }}/machine-emulator:tests /usr/bin/cartesi-machine-tests run | ||
|
||
- name: Save and Load | ||
run: | | ||
mkdir -m 755 -p ${{ env.CARTESI_IMAGES_PATH }}/snapshots | ||
docker run --rm -v ${{ env.CARTESI_IMAGES_PATH }}:${{ env.CARTESI_IMAGES_PATH }} -t ${{ github.repository_owner }}/machine-emulator:devel /usr/bin/cartesi-machine --max-mcycle=0 --store=${{ env.CARTESI_IMAGES_PATH }}/snapshots/save_and_load_test | ||
docker run --rm -v ${{ env.CARTESI_IMAGES_PATH }}:${{ env.CARTESI_IMAGES_PATH }} -t ${{ github.repository_owner }}/machine-emulator:devel /usr/bin/cartesi-machine --load=${{ env.CARTESI_IMAGES_PATH }}/snapshots/save_and_load_test | ||
sudo rm -rf ${{ env.CARTESI_IMAGES_PATH }}/snapshots | ||
docker run --rm -t ${{ github.repository_owner }}/machine-emulator:tests /usr/share/cartesi-machine/tests/scripts/test-save-and-load.sh | ||
- name: Run test scripts | ||
run: | | ||
docker run --rm -v ${{ env.CARTESI_IMAGES_PATH }}:${{ env.CARTESI_IMAGES_PATH }} -v ${{ env.CARTESI_TESTS_PATH }}:${{ env.CARTESI_TESTS_PATH }} -t ${{ github.repository_owner }}/machine-emulator:devel ./src/tests/run.sh | ||
docker run --rm -t ${{ github.repository_owner }}/machine-emulator:tests /usr/share/cartesi-machine/tests/scripts/run-lua-tests.sh | ||
- name: Run grpc lua test scripts | ||
run: | | ||
docker run --rm -v ${{ env.CARTESI_IMAGES_PATH }}:${{ env.CARTESI_IMAGES_PATH }} -v ${{ env.CARTESI_TESTS_PATH }}:${{ env.CARTESI_TESTS_PATH }} -t ${{ github.repository_owner }}/machine-emulator:devel ./src/tests/test-grpc-server.sh remote-cartesi-machine cartesi-machine cartesi-machine-tests ${{ env.CARTESI_TESTS_PATH }} | ||
docker run --rm -t ${{ github.repository_owner }}/machine-emulator:tests /usr/share/cartesi-machine/tests/scripts/test-grpc-server.sh remote-cartesi-machine cartesi-machine cartesi-machine-tests | ||
- name: Run jsonrpc lua test scripts | ||
run: | | ||
docker run --rm -v ${{ env.CARTESI_IMAGES_PATH }}:${{ env.CARTESI_IMAGES_PATH }} -v ${{ env.CARTESI_TESTS_PATH }}:${{ env.CARTESI_TESTS_PATH }} -t ${{ github.repository_owner }}/machine-emulator:devel ./src/tests/test-jsonrpc-server.sh jsonrpc-remote-cartesi-machine cartesi-machine cartesi-machine-tests ${{ env.CARTESI_TESTS_PATH }} | ||
docker run --rm -t ${{ github.repository_owner }}/machine-emulator:tests /usr/share/cartesi-machine/tests/scripts/test-jsonrpc-server.sh jsonrpc-remote-cartesi-machine cartesi-machine cartesi-machine-tests | ||
- name: Run Merkle tree tests | ||
run: | | ||
docker run --rm -v ${{ env.CARTESI_IMAGES_PATH }}:${{ env.CARTESI_IMAGES_PATH }} -v ${{ env.CARTESI_TESTS_PATH }}:${{ env.CARTESI_TESTS_PATH }} -t ${{ github.repository_owner }}/machine-emulator:devel ./src/tests/test-merkle-tree-hash --log2-root-size=30 --log2-leaf-size=12 --input=./src/tests/test-merkle-tree-hash | ||
docker run --rm -t ${{ github.repository_owner }}/machine-emulator:tests test-merkle-tree-hash --log2-root-size=30 --log2-leaf-size=12 --input=/usr/bin/test-merkle-tree-hash | ||
- name: Run C API tests | ||
run: | | ||
docker run --rm -v ${{ env.CARTESI_IMAGES_PATH }}:${{ env.CARTESI_IMAGES_PATH }} -v ${{ env.CARTESI_TESTS_PATH }}:${{ env.CARTESI_TESTS_PATH }} -t ${{ github.repository_owner }}/machine-emulator:devel ./src/tests/test-machine-c-api | ||
docker run --rm -t ${{ github.repository_owner }}/machine-emulator:tests test-machine-c-api | ||
- name: Test microarchitecture interpreter | ||
if: false | ||
run: | | ||
docker run --rm -t ${{ github.repository_owner }}/machine-emulator:devel make uarch-tests run-uarch-tests JOBS=-j$(nproc) | ||
docker run --rm -t ${{ github.repository_owner }}/machine-emulator:tests make uarch-tests run-uarch-tests JOBS=-j$(nproc) | ||
- name: Run rv64ui test suite on microarchitecture | ||
run: | | ||
docker run --rm -v ${{ env.CARTESI_TESTS_PATH }}:${{ env.CARTESI_TESTS_PATH }} -t ${{ github.repository_owner }}/machine-emulator:devel /usr/bin/uarch-riscv-tests --test-path=${{ env.CARTESI_TESTS_PATH }} run | ||
docker run --rm -t ${{ github.repository_owner }}/machine-emulator:tests uarch-riscv-tests run | ||
- name: Run test suite with Microarchitecture | ||
run: | | ||
docker run --rm -v ${{ env.CARTESI_IMAGES_PATH }}:${{ env.CARTESI_IMAGES_PATH }} -v ${{ env.CARTESI_TESTS_PATH }}:${{ env.CARTESI_TESTS_PATH }} -t ${{ github.repository_owner }}/machine-emulator:devel /usr/bin/cartesi-machine-tests --test-path=${{ env.CARTESI_TESTS_PATH }} --jobs=$(nproc) run_uarch | ||
docker run --rm -t ${{ github.repository_owner }}/machine-emulator:tests cartesi-machine-tests--jobs=$(nproc) run_uarch | ||
- name: Run test suite with microarchitecture and host based interpreters comparing machine hashes at every step | ||
run: | | ||
docker run --rm -v ${{ env.CARTESI_IMAGES_PATH }}:${{ env.CARTESI_IMAGES_PATH }} -v ${{ env.CARTESI_TESTS_PATH }}:${{ env.CARTESI_TESTS_PATH }} -t ${{ github.repository_owner }}/machine-emulator:devel /usr/bin/cartesi-machine-tests --test="^rv64ui.*$" --test-path=${{ env.CARTESI_TESTS_PATH }} --jobs=$(nproc) run_host_and_uarch | ||
docker run --rm -t ${{ github.repository_owner }}/machine-emulator:tests cartesi-machine-tests --test="^rv64ui.*$" --jobs=$(nproc) run_host_and_uarch | ||
- name: Create uarch json logs to be used to test the Solidity based microarchitecture interpreter | ||
run: | | ||
mkdir -p /opt/cartesi/share/logs/uarch-riscv-tests-json-logs | ||
docker run --rm -v /opt/cartesi/share/logs:/opt/cartesi/share/logs -v ${{ env.CARTESI_TESTS_PATH }}:${{ env.CARTESI_TESTS_PATH }} -t ${{ github.repository_owner }}/machine-emulator:devel /usr/bin/uarch-riscv-tests --test-path=${{ env.CARTESI_TESTS_PATH }} --output-dir=/opt/cartesi/share/logs/uarch-riscv-tests-json-logs --proofs --proofs-frequency=1 json-step-logs | ||
docker run --rm -v /opt/cartesi/share/logs:/opt/cartesi/share/logs -v ${{ env.CARTESI_TESTS_PATH }}:${{ env.CARTESI_TESTS_PATH }} -t ${{ github.repository_owner }}/machine-emulator:devel /usr/bin/uarch-riscv-tests --test-path=${{ env.CARTESI_TESTS_PATH }} --output-dir=/opt/cartesi/share/logs/uarch-riscv-tests-json-logs --proofs json-reset-log | ||
docker run --rm -v /opt/cartesi/share/logs:/opt/cartesi/share/logs -t ${{ github.repository_owner }}/machine-emulator:tests uarch-riscv-tests --output-dir=/opt/cartesi/share/logs/uarch-riscv-tests-json-logs --proofs --proofs-frequency=1 json-step-logs | ||
docker run --rm -v /opt/cartesi/share/logs:/opt/cartesi/share/logs -t ${{ github.repository_owner }}/machine-emulator:tests uarch-riscv-tests --output-dir=/opt/cartesi/share/logs/uarch-riscv-tests-json-logs --proofs json-reset-log | ||
- name: Compress uarch json logs | ||
run: tar -czf uarch-riscv-tests-json-logs.tar.gz -C /opt/cartesi/share/logs/uarch-riscv-tests-json-logs . | ||
|
@@ -258,6 +252,7 @@ jobs: | |
test_arm64: | ||
name: Test (linux/arm64) | ||
needs: build | ||
if: false | ||
runs-on: ubuntu-latest-8-cores | ||
steps: | ||
- name: Checkout machine emulator source code | ||
|
@@ -454,6 +449,7 @@ jobs: | |
coverage: | ||
name: Coverage | ||
runs-on: ubuntu-latest-8-cores | ||
if: false | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
|
@@ -552,6 +548,7 @@ jobs: | |
sanitize: | ||
name: Sanitize | ||
runs-on: ubuntu-22.04 | ||
if: false | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
|
@@ -638,6 +635,7 @@ jobs: | |
name: Publish artifacts | ||
needs: [static-analysis, coverage, sanitize, test_amd64, test_arm64] | ||
runs-on: ubuntu-22.04 | ||
if: false | ||
steps: | ||
- name: Checkout emulator source code | ||
uses: actions/checkout@v3 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
[submodule "lib/grpc-interfaces"] | ||
path = lib/grpc-interfaces | ||
url = ../grpc-interfaces.git | ||
[submodule "tests/riscv-tests"] | ||
path = tests/riscv-tests | ||
url = ../riscv-tests.git | ||
[submodule "tests/riscv-arch-test"] | ||
path = tests/riscv-arch-test | ||
url = ../riscv-arch-test.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.