Skip to content

Commit

Permalink
Setup CI and fix some small errors
Browse files Browse the repository at this point in the history
  • Loading branch information
byroot committed Jul 28, 2023
1 parent aa3e716 commit b3a256d
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 12 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
name: Test
on: [push, pull_request]

jobs:
ruby:
name: Ruby ${{ matrix.ruby }}
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
ruby: ["3.2", "3.1", "3.0", "2.7", "2.6"]
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true

- name: Tests
run: ./test.sh
5 changes: 1 addition & 4 deletions ext/rbtrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -876,9 +876,7 @@ eval_inspect(VALUE rb_code) {
}

static VALUE
rescue_inspect(VALUE arg) {
VALUE exception = rb_errinfo(); /* get last exception */
rb_set_errinfo(Qnil);
rescue_inspect(VALUE arg, VALUE exception) {
return rb_funcall(exception, rb_intern("inspect"), 0);
}

Expand All @@ -891,7 +889,6 @@ rbtrace__process_event(msgpack_object cmd)
static int last_tracer_id = -1; // hax
char query[BUF_SIZE];

char code[BUF_SIZE+150];
VALUE val = Qnil;

msgpack_object_array ary;
Expand Down
3 changes: 1 addition & 2 deletions lib/rbtrace/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,7 @@ def self.run

opt :shapesdump,
"generate a shapes dump for the process in FILENAME",
:default => "AUTO",

:default => "AUTO"
end

opts = Optimist.with_standard_exception_handling(parser) do
Expand Down
2 changes: 1 addition & 1 deletion rbtrace.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Gem::Specification.new do |s|
s.add_dependency 'optimist', '>= 3.0.0'
s.add_dependency 'msgpack', '>= 0.4.3'

s.add_development_dependency "rake", "~> 10.0"
s.add_development_dependency "rake"

s.license = "MIT"
s.summary = 'rbtrace: like strace but for ruby code'
Expand Down
2 changes: 1 addition & 1 deletion server.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'ext/rbtrace'
require 'rbtrace'
require 'tmpdir'

class String
Expand Down
9 changes: 5 additions & 4 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ cd ..
bundle check
export RUBYOPT="-I.:lib"

ruby server.rb &
bundle exec ruby server.rb &
export PID=$!

trap cleanup INT TERM
Expand All @@ -23,11 +23,11 @@ cleanup() {

trace() {
echo ------------------------------------------
echo ./bin/rbtrace -p $PID $*
echo ./bin/rbtrace -p $PID "$@"
echo ------------------------------------------
./bin/rbtrace -p $PID $* &
bundle exec ./bin/rbtrace -p $PID "$@" &
sleep 2
kill $!
kill $! || true
wait $! || true
echo
}
Expand All @@ -37,6 +37,7 @@ trace -m sleep
trace -m sleep Dir.chdir Dir.pwd Process.pid "String#gsub" "String#*"
trace -m "Kernel#"
trace -m "String#gsub(self,@test)" "String#*(self,__source__)" "String#multiply_vowels(self,self.length,num)"
trace -e 'p(1 + 1)'
trace --gc --slow=200
trace --gc -m Dir.
trace --slow=250
Expand Down

0 comments on commit b3a256d

Please sign in to comment.