# test the resolution of unresolved struct typedefs
set test "unresolved-struct-typedef"
# process probes need utrace
if {![uprobes_p]} { untested "$test"; return }

for {set i 0} {$i < [all_compile_flags]} {incr i} {
  set extra_flag [all_compile_flag $i]
  set extra_name [all_compile_flag_name $i]

  set test_flags "additional_flags=-g"
  set test_flags "$test_flags [sdt_includes]"
  set test_flags "$test_flags $extra_flag"

  # we deliberately don't #include time.h in the main CU
  # instead we pull the header in as a separate CU
  set test_flags "$test_flags additional_flags=-fno-eliminate-unused-debug-types"
  set test_flags "$test_flags additional_flags=-xc"
  set test_flags "$test_flags additional_flags=/usr/include/time.h"

  set res [target_compile "$srcdir/$subdir/$test.c" "$test.exe" executable "$test_flags"]
  if { $res != "" } {
    verbose "target_compile failed: $res" 2
    fail "$test-$extra_name compile"
    untested "$test-$extra_name"
    return
  } else {
    pass "$test-$extra_name compile"
  }

  set script {{ probe process(@1).mark("epoch") { println($epoch->tm_year) } }}
  foreach runtime [get_runtime_list] {
    if {$runtime != ""} {
      stap_compile "$test-$extra_name-$runtime" 1 "$script" \
	--runtime=$runtime "$test.exe"
    } else {
      stap_compile "$test-$extra_name" 1 "$script" "$test.exe"
    }
  }
  catch {exec rm -f "$test.exe"}
}
