Ruby li_std_set test failure workaround
Prevent GC from collecting "hello" string in testcase as workaround to prevent GC occasionally causing segfault. Issue #2115
This commit is contained in:
parent
a3b49ef75e
commit
f029beffe8
2 changed files with 6 additions and 3 deletions
1
.github/workflows/ci.yml
vendored
1
.github/workflows/ci.yml
vendored
|
|
@ -167,7 +167,6 @@ jobs:
|
|||
VER: '2.5'
|
||||
- SWIGLANG: ruby
|
||||
VER: '2.6'
|
||||
continue-on-error: true # Sometimes fails, see https://github.com/swig/swig/issues/2115
|
||||
- SWIGLANG: ruby
|
||||
VER: '2.7'
|
||||
- SWIGLANG: ruby
|
||||
|
|
|
|||
|
|
@ -56,11 +56,15 @@ m.value == 'c'
|
|||
s = LanguageSet.new
|
||||
s.insert([1,2])
|
||||
s.insert(1)
|
||||
s.insert("hello")
|
||||
# There is a reference count issue that needs fixing, see https://github.com/swig/swig/issues/2115
|
||||
# Workaround is to create hello variable containing a string and use it instead of just "hello"
|
||||
hello = "hello"
|
||||
s.insert(hello)
|
||||
#s.to_a == [1,[1,2],'hello'] # sort order: s.sort {|a,b| a.hash <=> b.hash}
|
||||
# Test above is flawed as LanguageSet sorts by each element's hash, so the order will change from one invocation to the next. Sort a conversion to array instead.
|
||||
GC.start
|
||||
sa = s.to_a.sort { |x, y| x.to_s <=> y.to_s }
|
||||
sa == [1,[1,2],'hello']
|
||||
sa == [1,[1,2],hello]
|
||||
|
||||
EOF
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue