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

    # 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/fortyfive.stp -
	buildok/nd_syscalls-all-probes.stp -
	buildok/nd_syscalls-arch-detailed.stp -
	buildok/nd_syscalls-detailed.stp -
	buildok/nd_syscalls2-detailed.stp {
	    # Any test that uses nd_syscalls probes do not work on ia64.
	    if {$rc != 0 && [istarget ia64-*-*]} { setup_kfail 6971 ia64-*-* }
	}

	buildok/memory-write_shared_copy.stp {
	    if {$rc != 0} { setup_kfail 1155 *-*-* } }

	buildok/memory-mmap.stp -
	buildok/memory-write_shared_copy.stp -
	buildok/networking-change_rx_flag.stp -
	buildok/nfs-fop.check_flags.stp -
	buildok/nfs_proc-detailed.stp -
	buildok/nfsd-detailed.stp -
	buildok/rpc-detailed.stp -
	buildok/scheduler-cpu_off.stp -
	buildok/scheduler-ctxswitch.stp -
	buildok/scheduler-migrate.stp -
	buildok/signal-check_ignored.stp -
	buildok/signal-handle.stp -
	buildok/tty-resize.stp -
	buildok/vfs-detailed.stp {
	    # Use setup_kfail GCC <target triplet> for
	    # debuginfo-quality problems.
	    if {$rc != 0} { setup_kfail GCC *-*-* } }

        buildok/per-process-syscall.stp -
        buildok/utrace.stp {
	    # Use setup_kfail UTRACE <target triplet> for systems
	    # without utrace.
	    if {$rc != 0 && ![utrace_p]} { setup_kfail UTRACE *-*-*} }

	buildok/pretty-uprobes.stp -
	buildok/ucontext-symbols-embedded.stp -
	buildok/ucontext-unwind-embedded.stp {
	    # Use setup_kfail UPROBES <target triplet> for systems
	    # without uprobes. (ia64 has utrace, but not uprobes.)
	    if {$rc != 0 && ![uprobes_p]} { setup_kfail UPROBES *-*-* } }

	buildok/twentyeightprime.stp {
	    # Use setup_kfail UPROBES <target triplet> for systems
	    # without uprobes. (ia64 has utrace, but not uprobes.)
	    if {$rc != 0 && ![uprobes_p]} { setup_kfail UPROBES *-*-* }

	    # Use setup_kfail INODE_UPROBES <target triplet> for
	    # systems with inode uprobes, where absolute probes don't
	    # work.
	    if {$rc != 0 && [inode_uprobes_p]} {
		setup_kfail INODE_UPROBES *-*-* }
	}

	buildok/context-symbols-embedded.stp -
	buildok/context-unwind-embedded.stp {
	    # Use setup_kfail UNWIND <target triplet> for systems
	    # with an unsupported dwarf unwind architecture
	    if {$rc != 0 && [istarget ia64-*-*]} {
		setup_kfail UNWIND ia64-*-* } }

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