set self buildok
set runtime dyninst

if {![dyninst_p]} {
    untested "$self ($runtime) : no $runtime support found"
    return
}

foreach file [lsort [glob -nocomplain $srcdir/$self/*.stp]] {
    set test $self/[file tail $file]
    verbose -log "Running $file ($runtime)"
    set rc [stap_run_batch $file --runtime=$runtime]

    # Use setup_kfail <pr number> <target triplet> for known bugs.
    #
    # (Note that tcl doesn't like comments directly inside the switch
    # statement, but comments can go in sub-blocks.)
    switch $test {
	buildok/alias_suffixes02.stp -
	buildok/alias_suffixes03.stp -
	buildok/alias_suffixes04.stp -
	buildok/alias_suffixes05.stp -
	buildok/alias_suffixes06.stp -
	buildok/atomic.stp -
	buildok/aux_syscalls-embedded.stp -
	buildok/context-embedded.stp -
	buildok/context-symbols-embedded.stp -
	buildok/context-unwind-embedded.stp -
	buildok/conversions-embedded.stp -
	buildok/conversions-guru-embedded.stp -
	buildok/conversions.stp -
	buildok/dentry-embedded.stp -
	buildok/dev-embedded.stp -
	buildok/eighteen.stp -
	buildok/fifteen.stp -
	buildok/five.stp -
	buildok/fortyfive.stp -
	buildok/fortysix.stp -
	buildok/fortytwo.stp -
	buildok/fourteen-plus.stp -
	buildok/fourteen.stp -
	buildok/gtod_noinit.stp -
	buildok/guru.stp -
	buildok/histogram_operator_in.stp -
	buildok/hwbkpt.stp -
	buildok/inet_sock-embedded.stp -
	buildok/ioblock-all-probes.stp -
	buildok/ioblock-detailed.stp -
	buildok/ioblock-embedded.stp -
	buildok/ioscheduler-all-probes.stp -
	buildok/ioscheduler-detailed.stp -
	buildok/ioscheduler-embedded.stp -
	buildok/ip-embedded.stp -
	buildok/ipmib-all-probes.stp -
	buildok/ipmib-detailed.stp -
	buildok/ipmib-embedded.stp -
	buildok/iterate_histogram_buckets.stp -
	buildok/kprocess-all-probes.stp -
	buildok/kprocess-detailed.stp -
	buildok/kprocess-embedded.stp -
	buildok/linuxmib-all-probes.stp -
	buildok/linuxmib-detailed.stp -
	buildok/logging-embedded.stp -
	buildok/maxactive01.stp -
	buildok/memory-all-probes.stp -
	buildok/memory-detailed.stp -
	buildok/memory-embedded.stp -
	buildok/memory-mmap.stp -
	buildok/memory.stp -
	buildok/nd_syscalls-all-probes.stp -
	buildok/nd_syscalls-arch-detailed.stp -
	buildok/nd_syscalls-detailed.stp -
	buildok/nd_syscalls2-detailed.stp -
	buildok/netfilter01.stp -
	buildok/netfilter02.stp -
	buildok/netfilter03.stp -
	buildok/netfilter04.stp -
	buildok/networking-all-probes.stp -
	buildok/networking-detailed.stp -
	buildok/networking-embedded.stp -
	buildok/newlocals01.stp -
	buildok/nfs-all-probes.stp -
	buildok/nfs-detailed.stp -
	buildok/nfs-embedded.stp -
	buildok/nfs-fop.check_flags.stp -
	buildok/nfs_proc-detailed.stp -
	buildok/nfs_proc-embedded.stp -
	buildok/nfsd-all-probes.stp -
	buildok/nfsd-detailed.stp -
	buildok/nfsd-embedded.stp -
	buildok/nfsderrno-embedded.stp -
	buildok/oldlocals02.stp -
	buildok/pr10678.stp -
	buildok/pr13284.stp -
	buildok/pretty.stp -
	buildok/print_histogram_entry.stp -
	buildok/print_histograms.stp -
	buildok/proc_mem-embedded.stp -
	buildok/process_test.stp -
	buildok/procfs01.stp -
	buildok/queue_stats-embedded.stp -
	buildok/rcu.stp -
	buildok/rpc-all-probes.stp -
	buildok/rpc-detailed.stp -
	buildok/rpc-embedded.stp -
	buildok/scheduler-all-probes.stp -
	buildok/scheduler-cpu_off.stp -
	buildok/scheduler-ctxswitch.stp -
	buildok/scheduler-detailed.stp -
	buildok/scheduler-embedded.stp -
	buildok/scsi-all-probes.stp -
	buildok/scsi-detailed.stp -
	buildok/scsi-embedded.stp -
	buildok/seven.stp -
	buildok/seventeen.stp -
	buildok/signal-all-probes.stp -
	buildok/signal-check_ignored.stp -
	buildok/signal-detailed.stp -
	buildok/signal-embedded.stp -
	buildok/signal-handle.stp -
	buildok/six.stp -
	buildok/socket-all-probes.stp -
	buildok/socket-detailed.stp -
	buildok/socket-embedded.stp -
	buildok/stopwatches.stp -
	buildok/syscall.stp -
	buildok/syscalls-arch-detailed.stp -
	buildok/syscalls-detailed.stp -
	buildok/syscalls2-detailed.stp -
	buildok/systemtap_privilege.stp -
	buildok/task-embedded.stp -
	buildok/task_test.stp -
	buildok/task_time-embedded.stp -
	buildok/tcp-all-probes.stp -
	buildok/tcp-detailed.stp -
	buildok/tcp-embedded.stp -
	buildok/tcp_test.stp -
	buildok/tcpmib-all-probes.stp -
	buildok/tcpmib-detailed.stp -
	buildok/tcpmib-embedded.stp -
	buildok/thirteen.stp -
	buildok/thirtyone.stp -
	buildok/thirtytwo.stp -
	buildok/three.stp -
	buildok/timestamp-embedded.stp -
	buildok/timestamp_monotonic-embedded.stp -
	buildok/tty-detailed.stp -
	buildok/tty-resize.stp -
	buildok/twenty.stp -
	buildok/twentyeight.stp -
	buildok/twentyeightprime.stp -
	buildok/twentyfive.stp -
	buildok/twentynine.stp -
	buildok/twentyseven.stp -
	buildok/twentythree.stp -
	buildok/twentytwo.stp -
	buildok/two.stp -
	buildok/ucontext-embedded.stp -
	buildok/ucontext-symbols-embedded.stp -
	buildok/ucontext-unwind-embedded.stp -
	buildok/udp-all-probes.stp -
	buildok/udp-detailed.stp -
	buildok/udp_test.stp -
	buildok/vfs-all-probes.stp -
	buildok/vfs-detailed.stp -
	buildok/vfs-embedded.stp -
	buildok/xtime.stp {
	    # Use setup_kfail DYNINST <target triplet> for known
	    # failures when running with the dyninst runtime (scripts
	    # that use kernel features or kernel-only tapset
	    # functions).
	    if {$rc != 0} { setup_kfail DYNINST *-*-* } }

	buildok/fortyseven.stp {
	    if {$rc != 0} { setup_kfail 15065 *-*-* } }

	buildok/per-process-syscall.stp {
	    # Use setup_kfail 14708 <target triplet> for known
	    # failures when running with the dyninst runtime (scripts
	    # that use utrace-like probes)
	    if {$rc != 0} { setup_kfail 14708 *-*-* } }
    }

    if {$rc == 0} { pass "$test ($runtime)" } else { fail "$test ($runtime)" }
}
