[PATCH V2 7/9] Simple testsuite for DTrace USDT probes.

Pedro Alves palves@redhat.com
Thu Oct 16 22:36:00 GMT 2014


Hi Jose,

> +    set result [catch "exec $dtrace -V" output]

Please use "remote_exec host" to invoke tools on the host.

> +    set dscript_file "${srcdir}/${subdir}/${testfile}.d"
> +    set out_header_file "${srcdir}/${subdir}/${testfile}.h"

Generating files in the ${srcdir} is a no-no.
Use standard_output_file to put this in the build dir, and to
make it parallel safe.

> +    set result \
> +        [catch "exec $dtrace -h -s $dscript_file -o $out_header_file" output]
> +    verbose -log $output


> +    if {$result != 0} {
> +        fail "invoke dtrace -h to generate the header file for USDT probes"
> +        return -1
> +    }
> +
> +    if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}.o" object {debug}] != ""} {
> +        fail "compile ${binfile}.o"
> +        return -1
> +    }
> +
> +    set result \
> +        [catch "exec $dtrace -G -s $dscript_file ${binfile}.o -o ${binfile}-p.o" output]
> +    verbose -log $output
> +    if {$result != 0} {
> +        fail "invoke dtrace -G to generate the object file with probe information"
> +        return -1
> +    }
> +
> +    if {[gdb_compile "${binfile}.o ${binfile}-p.o" ${binfile} executable {debug}] != ""} {
> +        fail "compile ${binfile}"
> +        return -1
> +    }

Seems like this routine may be general enough that it'd be reused for other
tests.  How about putting it a new testsuite/lib/dtrace.exp file?

It's not usual that failure to compile generates a FAIL.  Do we need that?
Instead, it's more usual for the caller of a routine that builds
the test to call "untested" on build failure.

> +    gdb_test "break -pdtrace test:two-locations" \
> +        "Breakpoint \[0-9\]+ at $hex.*2 locations.*" \
> +        "set multii-location probe breakpoint (probe two-locations)"

typo "multii".


Thanks,
Pedro Alves



More information about the Gdb-patches mailing list