Commit 4418371c authored by Brice Videau's avatar Brice Videau
Browse files

Refactored test harness.

parent f3a90e2e
Pipeline #12845 failed with stage
......@@ -83,6 +83,7 @@ AC_CONFIG_FILES([Makefile
AC_CONFIG_FILES([opencl/tracer_opencl.sh], [chmod +x opencl/tracer_opencl.sh])
AC_CONFIG_FILES([opencl/babeltrace_opencl], [chmod +x opencl/babeltrace_opencl])
AC_CONFIG_FILES([opencl/extract_enqueues], [chmod +x opencl/extract_enqueues])
AC_CONFIG_FILES([opencl/test_wrapper.sh], [chmod +x opencl/test_wrapper.sh])
AC_CONFIG_FILES([ze/tracer_ze.sh], [chmod +x ze/tracer_ze.sh])
AC_CONFIG_FILES([ze/babeltrace_ze], [chmod +x ze/babeltrace_ze])
AC_CONFIG_FILES([cuda/babeltrace_cuda], [chmod +x cuda/babeltrace_cuda])
......
......@@ -49,6 +49,9 @@ opencl_model.yaml: $(srcdir)/gen_opencl_model.rb $(srcdir)/opencl_model.rb $(ML_
opencl_babeltrace_model.yaml: $(srcdir)/gen_babeltrace_model.rb opencl_model.yaml
SRC_DIR=$(srcdir) $(RUBY) $(srcdir)/gen_babeltrace_model.rb > $@
opencl_dummy_trace.yaml: opencl_babeltrace_model.yaml
$(RUBY) $(top_srcdir)/utils/gen_dummy_trace.rb opencl_babeltrace_model.yaml > $@
opencl_tracepoints.tp: $(srcdir)/gen_opencl_probes.rb $(srcdir)/opencl_model.rb tracer_opencl.h $(ML_FILES) cl.xml.patched $(srcdir)/opencl_tracepoints.rb $(srcdir)/opencl_wrapper_events.yaml
SRC_DIR=$(srcdir) $(RUBY) $(srcdir)/gen_opencl_probes.rb > $@
......@@ -198,24 +201,29 @@ libTestingCLProf_la_CXXFLAGS = -std=c++17 -Wall -Wextra -Wno-unused-parameter -W
libTestingCLProf_la_LDFLAGS = $(BABELTRACE2_LIBS) -avoid-version -module
TEST_FILES = \
profiling_normal.dust \
profiling_inversed.dust \
profiling_block.dust \
profiling_fast.dust \
profiling_interleave_thread.dust \
profiling_interleave_process.dust \
profiling_normal_command_queue.dust \
profiling_with_error.dust \
profiling_normal_command_queue_created_in_other_thread.dust \
device_name.dust \
kernel_name.dust \
profiling_normal_nd_range_kernel_name.dust \
API_call.dust
tests/opencl_dummy_trace.dust \
tests/trace.dust
# profiling_normal.dust \
# profiling_inversed.dust \
# profiling_block.dust \
# profiling_fast.dust \
# profiling_interleave_thread.dust \
# profiling_interleave_process.dust \
# profiling_normal_command_queue.dust \
# profiling_with_error.dust \
# profiling_normal_command_queue_created_in_other_thread.dust \
# device_name.dust \
# kernel_name.dust \
# profiling_normal_nd_range_kernel_name.dust \
# API_call.dust
TESTS = $(TEST_FILES)
TEST_EXTENSIONS = .dust
DUST_LOG_COMPILER = $(srcdir)/test_wrapper.sh
DUST_LOG_COMPILER = ./test_wrapper.sh
check_DATA = \
test_wrapper.sh \
opencl_dummy_trace.yaml
data_DATA = \
opencl_model.yaml \
......@@ -256,6 +264,7 @@ CLEANFILES = \
cl.xml.patched \
opencl_model.yaml \
opencl_babeltrace_model.yaml \
opencl_dummy_trace.yaml \
babeltrace_cl_dispatchers.c \
babeltrace_cl_callbacks.h \
clprof.c \
......
#!/usr/bin/env sh
name="$(basename $1 .dust)"
echo babeltrace2 --plugin-path=./.libs --component=source.dust.input --params="path=\"$1\"" --component=sink.testing_clprof.dispatch --params="test=\"${name}\""
babeltrace2 --plugin-path=./ --component=source.dust.input --params="path=\"$1\"" --component=sink.testing_clprof.dispatch --params="test=\"${name}\""
#!/usr/bin/env sh
name="$(basename $1 .dust)"
echo @RUBY@ @top_srcdir@/utils/dust.rb -s @builddir@/opencl_babeltrace_model.yaml -f $1
BABELTRACE_PLUGIN_PATH=@builddir@/.libs/ DUST_TRACE_DIR=@srcdir@/tests @RUBY@ @top_srcdir@/utils/dust.rb -s @builddir@/opencl_babeltrace_model.yaml -f $1
---
:trace: opencl_dummy_trace.yaml
:plugins:
- sink:opencl:dispatch
---
:trace: trace.yaml
:plugins:
- sink:opencl:dispatch
---
:stream_classes:
- :name: cl_stream_class
:schemas:
- thapi_opencl
:clock_snapshot_value: true
:streams:
- :name: stream0
:class: cl_stream_class
:events:
- :name: lttng_ust_opencl:clCreateEventFromEGLSyncKHR_entry
:stream: stream0
:clock_snapshot_value: 20
- :name: lttng_ust_opencl:clCreateEventFromEGLSyncKHR_exit
:stream: stream0
......@@ -4,21 +4,37 @@ require 'optparse'
$options = {
sink: 'text:details',
schemas: []
schemas: [],
trace: nil
}
OptionParser.new do |opts|
opts.banner = "Usage: dust.rb [options] trace_file"
opts.on("--sink PLUGIN", "Select sink plugin")
opts.on("-s", "--schemas x,y,z", Array, "List of schemas files to load")
end.parse!(into: $options)
$options[:sink] = $options[:sink].split(":")
$options[:schemas] = $options[:schemas].collect { |path|
schema = YAML.load_file(path)
[schema[:name], schema]
}.to_h
opts.on("--sink PLUGIN", "Select sink plugin") do |sink|
$options[:sink] = sink.split(":")
end
opts.on("-s", "--schemas x,y,z", Array, "List of schemas files to load") do |schemas|
$options[:schemas] = schemas.collect { |path|
schema = YAML.load_file(path)
[schema[:name], schema]
}.to_h
end
opts.on("-f", "--file FILENAME", "Configuration file Name") do |path|
dust_schema = YAML.load_file(path)
trace = dust_schema[:trace]
plugins = dust_schema[:plugins]
sink = plugins.select { |p| p.match(/^sink/) }.last
if sink
$options[:sink] = sink.split(":")[1..2]
end
$options[:trace] = trace
end
end.parse!
$trace_file = ARGV[0] ? ARGV[0] : $options[:trace]
raise "trace file not specified" unless $trace_file
unless File.exist?($trace_file)
$trace_file = File.join(ENV["DUST_TRACE_DIR"], $trace_file)
end
def create_datastructure(trace_class, l)
# Utils functions
......@@ -106,7 +122,6 @@ def create_datastructure(trace_class, l)
callback(trace_class, d)
end
$trace_file = ARGV[0]
BOTTOM_CLASS_DEFAULT = { BT_FIELD_CLASS_TYPE_SIGNED_INTEGER: 0,
BT_FIELD_CLASS_TYPE_BOOL: false,
......
require 'yaml'
model_path = ARGV[0]
d = YAML.load_file(model_path)
schema_name = d[:name]
events = d[:event_classes].collect{ |f| {name: f[:name], stream: 'stream0'} }
puts YAML.dump({
stream_classes: [
{ name: 'stream_class0', schemas: [ schema_name ], clock_snapshot_value: true }
],
streams: [ {name: 'stream0', class: 'stream_class0' } ],
events: events
})
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment