Skip to content
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
48 changes: 48 additions & 0 deletions .github/workflows/yjit-rust-port.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: YJIT Rust Port Temp Checks
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
- 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
63 changes: 63 additions & 0 deletions bootstraptest/test_yjit_rust_port.rb
Original file line number Diff line number Diff line change
@@ -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)
#}