- test_success "--condition event-rule-matches probe by address" \
- --condition event-rule-matches -k "--probe=0x${channel_enable_addr}" --event-name=my_channel_enable \
- --action notify
+skip $ist_root "non-root user: skipping kprobe tests" 18 || {
+ for type in kprobe kernel-probe; do
+ test_success "--condition event-rule-matches probe by symbol" \
+ --condition event-rule-matches --domain=kernel --type=$type --location=lttng_channel_enable --event-name=my_channel_enable \
+ --action notify
+
+ channel_enable_addr=$(grep ' t lttng_channel_enable\s\[lttng_tracer\]$' /proc/kallsyms | cut -f 1 -d ' ')
+ channel_disable_addr=$(grep ' t lttng_channel_disable\s\[lttng_tracer\]$' /proc/kallsyms | cut -f 1 -d ' ')
+
+ # We need to find a valid offset.
+ base_symbol=""
+ offset=0
+ if [[ 0x$channel_enable_addr -lt 0x$channel_disable_addr ]]; then
+ base_symbol="lttng_channel_enable"
+ offset=$(( 0x$channel_disable_addr - 0x$channel_enable_addr ))
+ else
+ base_symbol="lttng_channel_disable"
+ offset=$(( 0x$channel_enable_addr - 0x$channel_disable_addr ))
+ fi
+
+ offset_hex="0x$(printf '%x' $offset)"
+
+ test_success "--condition event-rule-matches probe by symbol with offset" \
+ --condition event-rule-matches --domain=kernel --type=$type --location="${base_symbol}+${offset_hex}" --event-name=my_$base_symbol \
+ --action notify
+
+ test_success "--condition event-rule-matches probe by address" \
+ --condition event-rule-matches --domain=kernel --type=$type --location="0x${channel_enable_addr}" --event-name=my_channel_enable \
+ --action notify
+ done