set test "flightrec2" if {![installtest_p]} { untested $test; return } # cleanup system "rm -f flightlog.out*" set pid 0 # check -S option spawn stap -F -o flightlog.out -S 1,3 $srcdir/$subdir/$test.stp expect { -timeout 240 -re {([0-9]+)\r\n} { pass "$test (-S option)" set pid $expect_out(1,string) exp_continue} timeout { fail "$test (timeout)"} eof { } } # After 10 seconds the stap run should be finished and logs generated # So, wait slightly more than 10 seconds - to be on the safe side. exec sleep 15 # At this point we've generated ~4.2MB of data. Given stap -S 1,3, we # can expect flightlog.out.2 flightlog.out.3 flightlog.out.4. Where # first two have their size roughly 1 MB and the last one roughly 200 kB. set scnt 0 set cnt1 0 # check log files eval spawn stat -c %s [glob flightlog.out.*] expect { -timeout 100 -re {[0-9]+} { incr cnt1; if {$expect_out(buffer) <= 1100000 } {incr scnt} exp_continue} timeout { fail "$test (logfile timeout)"} } catch { close }; catch { wait } exec sleep 3 set cnt2 0 # check logfile count if {$cnt1 == 3} { pass "$test (log file numbers limitation)" } else { fail "$test (log file numbers ($cnt1, $cnt2))" } # check logfile size if {$scnt == $cnt1 } { pass "$test (log file size limitation)" } else { fail "$test (log file size ($scnt != $cnt1))" }