Fix and enhance systemtap tests
Previous tests did not work correctly with RHEL-6
This commit is contained in:
parent
9fd772dd06
commit
88c977056b
@ -964,6 +964,9 @@ TZ=UTC make check TESTS="-v $DISABLE_TESTS"
|
|||||||
%{ruby_libdir}/tkextlib
|
%{ruby_libdir}/tkextlib
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Jul 19 2016 Pavel Valena <pvalena@redhat.com> - 2.3.0-60
|
||||||
|
- Fix and enhance systemtap tests
|
||||||
|
|
||||||
* Wed Apr 13 2016 Pavel Valena <pvalena@redhat.com> - 2.3.0-60
|
* Wed Apr 13 2016 Pavel Valena <pvalena@redhat.com> - 2.3.0-60
|
||||||
- Fix ruby lib path in macros.ruby.rh-ruby23
|
- Fix ruby lib path in macros.ruby.rh-ruby23
|
||||||
- Resolves: rhbz#1255753
|
- Resolves: rhbz#1255753
|
||||||
|
@ -3,8 +3,10 @@ require 'set'
|
|||||||
LIBRUBY_SO = 'libruby.so'
|
LIBRUBY_SO = 'libruby.so'
|
||||||
PROBES_D = 'probes.d'
|
PROBES_D = 'probes.d'
|
||||||
|
|
||||||
###
|
# These probes are excluded by VM_COLLECT_USAGE_DETAILS ifdef.
|
||||||
# Detect SystemTap section headers presence.
|
EXCLUDE_PROBES = Set.new %w(insn insn__operand)
|
||||||
|
|
||||||
|
## Detect SystemTap section headers presence
|
||||||
|
|
||||||
stap_headers = [
|
stap_headers = [
|
||||||
'\.stapsdt\.base',
|
'\.stapsdt\.base',
|
||||||
@ -22,43 +24,42 @@ unless detected_stap_headers.size == 2
|
|||||||
exit false
|
exit false
|
||||||
end
|
end
|
||||||
|
|
||||||
###
|
## Find if every declared probe is propagated to resulting library
|
||||||
# Find if every declared probe is propagated to resulting library.
|
|
||||||
|
|
||||||
# Colect probes specified in probes.d file.
|
# Colect probes specified in probes.d file.
|
||||||
probes = []
|
probes_declared = []
|
||||||
|
|
||||||
File.open(PROBES_D) do |file|
|
File.open(PROBES_D) do |file|
|
||||||
file.each_line do |line|
|
file.each_line do |line|
|
||||||
if probe = line[/probe (\S+)\(.*\);/, 1]
|
if probe = line[/probe (\S+)\(.*\);/, 1]
|
||||||
probes << probe
|
probes_declared << probe
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
probes = Set.new probes
|
probes_declared = Set.new probes_declared
|
||||||
|
|
||||||
# These probes are excluded by VM_COLLECT_USAGE_DETAILS ifdef.
|
unless EXCLUDE_PROBES.subset? probes_declared
|
||||||
EXCLUDE_PROBES = Set.new %w(insn insn__operand)
|
|
||||||
unless EXCLUDE_PROBES.subset? probes
|
|
||||||
puts 'ERROR: Change in SystemTap (DTrace) probes definition file detected.'
|
puts 'ERROR: Change in SystemTap (DTrace) probes definition file detected.'
|
||||||
exit false
|
exit false
|
||||||
end
|
end
|
||||||
|
|
||||||
probes -= EXCLUDE_PROBES
|
probes_declared -= EXCLUDE_PROBES
|
||||||
|
|
||||||
# Detect probes in resulting library.
|
# Detect probes in resulting library.
|
||||||
probe_regexp = %r{
|
get_probes_detected = %r{
|
||||||
^\s*stapsdt\s*0[xX][0-9a-fA-F]+\tNT_STAPSDT \(SystemTap probe descriptors\)$
|
^\s*Provider:\s+ruby,\s+Name:\s+(\S+),\s+.*$
|
||||||
^\s*Provider: ruby$
|
|
||||||
^\s*Name: (\S+)$
|
|
||||||
}
|
}
|
||||||
|
|
||||||
notes = `readelf -n "#{LIBRUBY_SO}"`
|
probes_detected = `eu-readelf -n "#{LIBRUBY_SO}"`
|
||||||
detected_probes = Set.new notes.scan(probe_regexp).flatten
|
|
||||||
|
probes_detected = Set.new probes_detected.scan(get_probes_detected).flatten
|
||||||
|
|
||||||
# Both sets must be equal, otherwise something is wrong.
|
# Both sets must be equal, otherwise something is wrong.
|
||||||
unless probes == detected_probes
|
unless probes_declared == probes_detected
|
||||||
puts 'ERROR: SystemTap (DTrace) probes were not correctly propagated into resulting library.'
|
puts 'ERROR: SystemTap (DTrace) probes were not correctly propagated into resulting library.'
|
||||||
|
puts " Undetected probes: #{(probes_declared - probes_detected).sort.join(', ')}\n",
|
||||||
|
" Additional detected probes: #{(probes_detected - probes_declared).sort.join(', ')}"
|
||||||
|
|
||||||
exit false
|
exit false
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user