Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
matsadler committed May 9, 2024
1 parent 4333e75 commit 6b620f8
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 71 deletions.
88 changes: 32 additions & 56 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,61 +1,37 @@
name: Test

on:
- push
- pull_request
- push
- pull_request

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
ruby-version:
- "2.7"
- "3.0"
- "3.1"
- "3.2"
rustup-toolchain:
- "1.61"
- stable

steps:
- uses: actions/checkout@v3

- uses: oxidize-rb/actions/setup-ruby-and-rust@v1
with:
rustup-toolchain: ${{ matrix.rustup-toolchain }}
ruby-version: ${{ matrix.ruby-version }}
cache-version: v2
bundler-cache: true
cargo-cache: true
cargo-cache-extra-path: |
examples/rust_blank/tmp/
examples/complete_object/tmp/
examples/custom_exception_ruby/tmp/
examples/custom_exception_rust/tmp/
- name: Example gem tests (blank?)
working-directory: examples/rust_blank
run: bundle exec rake test

- name: Example gem tests (complete object)
working-directory: examples/complete_object
run: bundle exec rake test

- name: Example gem tests (custom exception defined in Ruby)
if: matrix.ruby-version != 'head'
working-directory: examples/custom_exception_ruby
run: bundle exec rake test

- name: Example gem tests (custom exception defined in Rust)
if: matrix.ruby-version != 'head'
working-directory: examples/custom_exception_rust
run: bundle exec rake test

- name: Run tests
run: cargo test --workspace
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- macos-latest
ruby-version:
- "3.1"
rustup-toolchain:
- stable

steps:
- uses: actions/checkout@v3

- uses: oxidize-rb/actions/setup-ruby-and-rust@v1
with:
rustup-toolchain: ${{ matrix.rustup-toolchain }}
ruby-version: ${{ matrix.ruby-version }}
cache-version: v2
bundler-cache: true
cargo-cache: true
cargo-cache-extra-path: |
examples/rust_blank/tmp/
examples/complete_object/tmp/
examples/custom_exception_ruby/tmp/
examples/custom_exception_rust/tmp/
- name: Run tests
run: cargo test --doc
31 changes: 16 additions & 15 deletions src/embed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,21 +130,22 @@ pub unsafe fn init() -> Cleanup {

#[inline(always)]
unsafe fn init_options(opts: &[&str]) {
let mut argv = vec![CString::new("ruby").unwrap()];
argv.extend(opts.iter().map(|s| CString::new(*s).unwrap()));
let mut argv = argv
.iter()
.map(|cs| cs.as_ptr() as *mut _)
.collect::<Vec<_>>();
let mut node = 0 as _;
protect(|| {
node = ruby_process_options(argv.len() as i32, argv.as_mut_ptr());
Ruby::get_unchecked().qnil()
})
.unwrap();
if ruby_exec_node(node) != 0 {
panic!("Ruby init code failed");
};
// let mut argv = vec![CString::new("ruby").unwrap()];
// argv.extend(opts.iter().map(|s| CString::new(*s).unwrap()));
// let mut argv = argv
// .iter()
// .map(|cs| cs.as_ptr() as *mut _)
// .collect::<Vec<_>>();
// let mut node = 0 as _;
// protect(|| {
// node = ruby_process_options(argv.len() as i32, argv.as_mut_ptr());
// Ruby::get_unchecked().qnil()
// })
// .unwrap();
// if ruby_exec_node(node) != 0 {
// panic!("Ruby init code failed");
// };
()
}

/// # Embedding
Expand Down

0 comments on commit 6b620f8

Please sign in to comment.