From 82adfb75b903ceb1850ae0d9912cc1e89d3cc8c2 Mon Sep 17 00:00:00 2001 From: Maxime Chevalier-Boisvert Date: Wed, 9 Mar 2022 11:19:53 -0500 Subject: [PATCH 1/4] Add yjit-rust-port test workflow --- .github/workflows/yjit-rust-port.yml | 50 ++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .github/workflows/yjit-rust-port.yml diff --git a/.github/workflows/yjit-rust-port.yml b/.github/workflows/yjit-rust-port.yml new file mode 100644 index 00000000000000..c61e2cd63bbe85 --- /dev/null +++ b/.github/workflows/yjit-rust-port.yml @@ -0,0 +1,50 @@ +name: YJIT Ubuntu +on: + push: + paths-ignore: + - 'doc/**' + - '**.md' + - '**.rdoc' + pull_request: + paths-ignore: + - 'doc/**' + - '**.md' + - '**.rdoc' + +concurrency: + group: ${{ github.workflow }} / ${{ startsWith(github.event_name, 'pull') && github.ref_name || github.sha }} + cancel-in-progress: ${{ startsWith(github.event_name, 'pull') }} + +jobs: + cargo: + name: Rust cargo test + # GitHub Action's image seems to already contain a Rust 1.58.0. + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + # For now we can't run cargo test --offline because it complains about the + # capstone dependency, even though the dependency is optional + #- run: cargo test --offline + - run: RUST_BACKTRACE=1 cargo test + working-directory: yjit + # Also compile and test with all features enabled + - run: RUST_BACKTRACE=1 cargo test --all-features + working-directory: yjit + make: + runs-on: ubuntu-20.04 + steps: + - name: Install libraries + run: | + set -x + sudo apt-get update -q || : + sudo apt-get install --no-install-recommends -q -y build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev bison autoconf ruby + - uses: actions/checkout@v2 + - run: ./autogen.sh + - run: CC=clang ./configure --enable-yjit=dev + + + + +defaults: + run: + working-directory: build From 5cfb0c2ee515be8816cad0776cb6b0ce819c1e95 Mon Sep 17 00:00:00 2001 From: Maxime Chevalier-Boisvert Date: Wed, 9 Mar 2022 11:21:29 -0500 Subject: [PATCH 2/4] Rename workflow --- .github/workflows/yjit-rust-port.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/yjit-rust-port.yml b/.github/workflows/yjit-rust-port.yml index c61e2cd63bbe85..4a8aa52e426c63 100644 --- a/.github/workflows/yjit-rust-port.yml +++ b/.github/workflows/yjit-rust-port.yml @@ -1,4 +1,4 @@ -name: YJIT Ubuntu +name: YJIT Rust Port Temp Checks on: push: paths-ignore: From a339fc02a45a119f40875beec64e9933463fb5dc Mon Sep 17 00:00:00 2001 From: Maxime Chevalier-Boisvert Date: Wed, 9 Mar 2022 11:24:56 -0500 Subject: [PATCH 3/4] Remove default working directory --- .github/workflows/yjit-rust-port.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/yjit-rust-port.yml b/.github/workflows/yjit-rust-port.yml index 4a8aa52e426c63..7c0bb3d05c5987 100644 --- a/.github/workflows/yjit-rust-port.yml +++ b/.github/workflows/yjit-rust-port.yml @@ -41,10 +41,3 @@ jobs: - uses: actions/checkout@v2 - run: ./autogen.sh - run: CC=clang ./configure --enable-yjit=dev - - - - -defaults: - run: - working-directory: build From 5f92ade43f4bab361d6c6fd397e12dd8523e1c56 Mon Sep 17 00:00:00 2001 From: Maxime Chevalier-Boisvert Date: Wed, 9 Mar 2022 11:39:21 -0500 Subject: [PATCH 4/4] Add simplified btest command to Rust YJIT port CI workflow --- .github/workflows/yjit-rust-port.yml | 5 +++ bootstraptest/test_yjit_rust_port.rb | 63 ++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 bootstraptest/test_yjit_rust_port.rb diff --git a/.github/workflows/yjit-rust-port.yml b/.github/workflows/yjit-rust-port.yml index 7c0bb3d05c5987..857bd32c932d99 100644 --- a/.github/workflows/yjit-rust-port.yml +++ b/.github/workflows/yjit-rust-port.yml @@ -41,3 +41,8 @@ jobs: - uses: actions/checkout@v2 - run: ./autogen.sh - run: CC=clang ./configure --enable-yjit=dev + - run: make -j miniruby + - run: make -j yjit-bindgen + # Try booting miniruby + - run: RUST_BACKTRACE=1 ./miniruby -e0 + - run: RUST_BACKTRACE=1 ruby --disable=gems bootstraptest/runner.rb --ruby="./miniruby -I./lib -I. -I.ext/common --disable-gems --yjit-call-threshold=1" bootstraptest/test_fiber.rb bootstraptest/test_finalizer.rb bootstraptest/test_flip.rb bootstraptest/test_fork.rb bootstraptest/test_load.rb bootstraptest/test_marshal.rb bootstraptest/test_string.rb bootstraptest/test_struct.rb bootstraptest/test_autoload.rb bootstraptest/test_class.rb bootstraptest/test_env.rb bootstraptest/test_yjit_rust_port.rb diff --git a/bootstraptest/test_yjit_rust_port.rb b/bootstraptest/test_yjit_rust_port.rb new file mode 100644 index 00000000000000..ce137c1cb3b5a6 --- /dev/null +++ b/bootstraptest/test_yjit_rust_port.rb @@ -0,0 +1,63 @@ +# Simple tests that we know we can pass +# To keep track of what we got working during the Rust port +# And avoid breaking/losing functionality + +# Test for opt_mod +assert_equal '2', %q{ + def mod(a, b) + a % b + end + + mod(7, 5) + mod(7, 5) +} + +# Test for opt_mult +assert_equal '12', %q{ + def mult(a, b) + a * b + end + + mult(6, 2) + mult(6, 2) +} + +# Test for opt_div +assert_equal '3', %q{ + def div(a, b) + a / b + end + + div(6, 2) + div(6, 2) +} + +# Test for opt_plus +assert_equal '5', %q{ + def plus(a, b) + a + b + end + + plus(3, 2) +} + +assert_equal 'true', %q{ + def foo(a, b) + a < b + end + + foo(2, 3) +} + +# FIXME: currently takes the wrong branch +#assert_equal '777', %q{ +# def foo(a, b) +# if a +# 777 +# else +# 333 +# end +# end +# +# foo(true, true) +#}