stack_frames 0.1.0 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7eb6415831cb725f642009b7e3faffaa31cc12e53986a50cc6c66afb22a40858
4
- data.tar.gz: 785cae19b0d65246275c483009711bf7adfbd99b2cee6c146f13711e1e87bf74
3
+ metadata.gz: 18a74c610d900bb78ed82f751d93c498d8c573f5a95cfc3984597abc504bffa0
4
+ data.tar.gz: ebff4be1938e844e1434e1320be9dba6f04376e4d451354e2245b30d351aacef
5
5
  SHA512:
6
- metadata.gz: b31829453fe42d5852a08f272a9604a0a8011faabb1e099c301311167b6b03db7c5eade3239d3b6a495c4164348af8d645a84315d3f4c4bc5a0c1352636cb194
7
- data.tar.gz: c06d4ad28aad9e559c4bb9702f12b69af603cbce2617fa4fbf8929fa2054c1b101587ea32776c398b12594ac361e21d8d97f3c1a1e917786c15a285c855a76f9
6
+ metadata.gz: 45279be5693b045b5ba53e1461bf92dc1df2db2b9ac4f357d2b6ee81899373287606050de8d72558be1b7cbbb0a141762f5c597c81375421584afcf0ac383e6c
7
+ data.tar.gz: 4620f5ff6607947f6f73e2940562e69101b40093a539ae56e0d7c0b32c2d11515056579d4662570d3bb002da6646b74145f02a6233d6dd758e11bd5de5d672c7
@@ -0,0 +1,35 @@
1
+ name: Tests
2
+
3
+ on:
4
+ push
5
+
6
+ jobs:
7
+ test:
8
+ runs-on: ubuntu-latest
9
+ strategy:
10
+ fail-fast: false
11
+ matrix:
12
+ ruby: [
13
+ '2.6', # minimum supported
14
+ '2.7',
15
+ '3.0',
16
+ '3.1',
17
+ ]
18
+ steps:
19
+ - uses: actions/checkout@v2
20
+ - uses: ruby/setup-ruby@v1
21
+ with:
22
+ ruby-version: ${{ matrix.ruby }}
23
+ bundler-cache: true
24
+ - run: bundle exec rake
25
+
26
+ valgrind:
27
+ runs-on: ubuntu-latest
28
+ steps:
29
+ - uses: actions/checkout@v2
30
+ - uses: ruby/setup-ruby@v1
31
+ with:
32
+ ruby-version: '3.1'
33
+ bundler-cache: true
34
+ - run: sudo apt-get install -y valgrind
35
+ - run: bundle exec rake test:valgrind
@@ -0,0 +1,22 @@
1
+ name: Contributor License Agreement (CLA)
2
+
3
+ on:
4
+ pull_request_target:
5
+ types: [opened, synchronize]
6
+ issue_comment:
7
+ types: [created]
8
+
9
+ jobs:
10
+ cla:
11
+ runs-on: ubuntu-latest
12
+ if: |
13
+ (github.event.issue.pull_request
14
+ && !github.event.issue.pull_request.merged_at
15
+ && contains(github.event.comment.body, 'signed')
16
+ )
17
+ || (github.event.pull_request && !github.event.pull_request.merged)
18
+ steps:
19
+ - uses: Shopify/shopify-cla-action@v1
20
+ with:
21
+ github-token: ${{ secrets.GITHUB_TOKEN }}
22
+ cla-token: ${{ secrets.CLA_TOKEN }}
data/Rakefile CHANGED
@@ -1,6 +1,9 @@
1
1
  require "bundler/gem_tasks"
2
2
  require "rake/testtask"
3
3
  require 'rake/extensiontask'
4
+ require "ruby_memcheck"
5
+
6
+ RubyMemcheck.config(binary_name: "stack_frames")
4
7
 
5
8
  ENV['STACK_FRAMES_DEV'] = '1'
6
9
 
@@ -8,10 +11,14 @@ Rake::ExtensionTask.new("stack_frames") do |ext|
8
11
  ext.lib_dir = 'lib/stack_frames'
9
12
  end
10
13
 
11
- Rake::TestTask.new(test: :compile) do |t|
14
+ test_config = lambda do |t|
12
15
  t.libs << "test"
13
16
  t.libs << "lib"
14
17
  t.test_files = FileList["test/**/*_test.rb"]
15
18
  end
19
+ Rake::TestTask.new(test: :compile, &test_config)
20
+ namespace :test do
21
+ RubyMemcheck::TestTask.new(valgrind: :compile, &test_config)
22
+ end
16
23
 
17
24
  task :default => :test
@@ -58,11 +58,12 @@ static VALUE buffer_initialize(VALUE self, VALUE size) {
58
58
  TypedData_Get_Struct(self, buffer_t, &buffer_data_type, buffer);
59
59
  buffer->profile_frames = ALLOC_N(VALUE, capacity);
60
60
  buffer->lines = ALLOC_N(int, capacity);
61
- buffer->capacity = capacity;
62
61
  buffer->frames = ALLOC_N(VALUE, capacity);
63
62
 
63
+ buffer->capacity = 0;
64
64
  for (int i = 0; i < capacity; i++) {
65
65
  buffer->frames[i] = stack_frame_new(self, i);
66
+ buffer->capacity++;
66
67
  }
67
68
  return Qnil;
68
69
  }
@@ -14,10 +14,6 @@ static void frame_mark(void *ptr)
14
14
  rb_gc_mark(frame->buffer);
15
15
  }
16
16
 
17
- static void frame_free(void *ptr)
18
- {
19
- }
20
-
21
17
  static size_t frame_memsize(const void *ptr)
22
18
  {
23
19
  return sizeof(frame_t);
@@ -25,7 +21,7 @@ static size_t frame_memsize(const void *ptr)
25
21
 
26
22
  const rb_data_type_t frame_data_type = {
27
23
  "stack_frames_frame",
28
- { frame_mark, frame_free, frame_memsize, },
24
+ { frame_mark, RUBY_DEFAULT_FREE, frame_memsize, },
29
25
  NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
30
26
  };
31
27
 
@@ -72,6 +68,8 @@ DEFINE_FRAME_ACCESSOR(qualified_method_name)
72
68
 
73
69
  void stack_frame_define(VALUE mStackFrames) {
74
70
  cFrame = rb_define_class_under(mStackFrames, "Frame", rb_cObject);
71
+ rb_global_variable(&cFrame);
72
+
75
73
  rb_define_alloc_func(cFrame, frame_allocate);
76
74
  rb_define_method(cFrame, "lineno", frame_lineno, 0);
77
75
  rb_define_method(cFrame, "path", frame_path, 0);
@@ -2,10 +2,8 @@
2
2
  #include "frame.h"
3
3
  #include "buffer.h"
4
4
 
5
- VALUE mStackFrames;
6
-
7
5
  void Init_stack_frames() {
8
- mStackFrames = rb_define_module("StackFrames");
6
+ VALUE mStackFrames = rb_define_module("StackFrames");
9
7
  stack_buffer_define(mStackFrames);
10
8
  stack_frame_define(mStackFrames);
11
9
  }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module StackFrames
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.2"
5
5
  end
data/stack_frames.gemspec CHANGED
@@ -14,6 +14,8 @@ Gem::Specification.new do |spec|
14
14
  spec.homepage = "https://github.com/Shopify/stack_frames"
15
15
  spec.license = "MIT"
16
16
 
17
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
18
+
17
19
  spec.extensions = ['ext/stack_frames/extconf.rb']
18
20
  # Specify which files should be added to the gem when it is released.
19
21
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
@@ -25,8 +27,9 @@ Gem::Specification.new do |spec|
25
27
  spec.require_paths = ["lib"]
26
28
 
27
29
  spec.add_development_dependency "bundler"
28
- spec.add_development_dependency "rake", "~> 10.0"
30
+ spec.add_development_dependency "rake", "~> 13.0"
29
31
  spec.add_development_dependency 'rake-compiler', '~> 1.0'
30
32
  spec.add_development_dependency "minitest", "~> 5.0"
31
33
  spec.add_development_dependency "stackprof", "~> 0.2.13"
34
+ spec.add_development_dependency "ruby_memcheck"
32
35
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stack_frames
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dylan Thacker-Smith
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-02-04 00:00:00.000000000 Z
11
+ date: 2022-11-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: '13.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: '13.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake-compiler
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: 0.2.13
83
+ - !ruby/object:Gem::Dependency
84
+ name: ruby_memcheck
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
83
97
  description:
84
98
  email:
85
99
  - gems@shopify.com
@@ -88,9 +102,9 @@ extensions:
88
102
  - ext/stack_frames/extconf.rb
89
103
  extra_rdoc_files: []
90
104
  files:
91
- - ".github/probots.yml"
105
+ - ".github/workflows/ci.yml"
106
+ - ".github/workflows/cla.yml"
92
107
  - ".gitignore"
93
- - ".travis.yml"
94
108
  - CODE_OF_CONDUCT.md
95
109
  - CONTRIBUTING.md
96
110
  - Gemfile
@@ -114,7 +128,8 @@ files:
114
128
  homepage: https://github.com/Shopify/stack_frames
115
129
  licenses:
116
130
  - MIT
117
- metadata: {}
131
+ metadata:
132
+ allowed_push_host: https://rubygems.org
118
133
  post_install_message:
119
134
  rdoc_options: []
120
135
  require_paths:
@@ -130,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
130
145
  - !ruby/object:Gem::Version
131
146
  version: '0'
132
147
  requirements: []
133
- rubygems_version: 3.0.3
148
+ rubygems_version: 3.3.3
134
149
  signing_key:
135
150
  specification_version: 4
136
151
  summary: Zero allocation backtraces using MRI's profile frames API
data/.github/probots.yml DELETED
@@ -1,3 +0,0 @@
1
- # .github/probots.yml
2
- enabled:
3
- - cla
data/.travis.yml DELETED
@@ -1,8 +0,0 @@
1
- ---
2
- sudo: false
3
- language: ruby
4
- cache: bundler
5
- rvm:
6
- - 2.4.9 # minimum supported
7
- - 2.7.0 # latest released
8
- before_install: gem install bundler -v 1.17.3