1 function set_chunk_pattern
()
3 # Need to call this function after $today has been set.
5 # YYYYMMDD-HHMMSS-YYYYMMDD-HHMMSS
6 export chunk_pattern
="${today}-[0-9][0-9][0-9][0-9][0-9][0-9]-${today}-[0-9][0-9][0-9][0-9][0-9][0-9]"
9 function validate_test_chunks
()
19 # Check if the 3 chunk folders exist and they contain a ${app_path}/metadata file.
20 ls $local_path/${chunk_pattern}-1/${app_path}/metadata
>/dev
/null
21 ok $?
"Chunk 1 exists"
22 ls $local_path/${chunk_pattern}-2/${app_path}/metadata
>/dev
/null
23 ok $?
"Chunk 2 exists"
24 ls $local_path/${chunk_pattern}-3/${domain} >/dev
/null
25 ok $?
"Chunk 3 exists"
27 # Make sure we don't have anything else in the first 2 chunk directories
28 # besides the kernel folder.
29 nr_stale
=$
(\
ls $local_path/${chunk_pattern}-1 |
grep -v $domain |
wc -l)
30 ok
$nr_stale "No stale folders in chunk 1 directory"
31 nr_stale
=$
(\
ls $local_path/${chunk_pattern}-2 |
grep -v $domain |
wc -l)
32 ok
$nr_stale "No stale folders in chunk 2 directory"
34 # We expect a session of 30 events
35 validate_trace_count
$EVENT_NAME $local_path 30
38 validate_trace_count
$EVENT_NAME $local_path/${chunk_pattern}-1 10
40 # Only delete if successful
41 rm -rf $local_path/${chunk_pattern}-1
45 validate_trace_count
$EVENT_NAME $local_path/${chunk_pattern}-2 20
47 # Only delete if successful
48 rm -rf $local_path/${chunk_pattern}-2
52 # Do not check in per-pid, because the folder is really empty, no metadata
54 if test $per_pid = 1; then
55 rm -rf $local_path/${chunk_pattern}-3
57 validate_trace_empty
$local_path/${chunk_pattern}-3
59 # Only delete if successful
60 rm -rf $local_path/${chunk_pattern}-3
64 # The session folder after all chunks have been removed is empty
65 test -z "$(\ls -A $local_path)"
67 ok
$empty "Trace folder is now empty"
68 if [ $empty -eq 0 ]; then
69 # Only delete if successful
76 function rotate_timer_test
()
86 # Wait for $expected_chunks to be generated, timeout after
87 # 3 * $expected_chunks * 0.5s.
88 # On a laptop with an empty session, a local rotation takes about 200ms,
89 # and a remote rotation takes about 600ms.
90 # We currently set the timeout to 6 seconds for 3 rotations, if we get
91 # errors, we can bump this value.
93 until [ $nr -ge $expected_chunks ] ||
[ $nr_iter -ge $
(($expected_chunks * 2 )) ]; do
94 nr
=$
(ls $local_path |
wc -l)
95 nr_iter
=$
(($nr_iter+1))
98 test $nr -ge $expected_chunks
99 ok $?
"Generated $nr chunks in $(($nr_iter))s"
100 stop_lttng_tracing_ok
$SESSION_NAME
101 destroy_lttng_session_ok
$SESSION_NAME
105 ok $?
"Date did not change during the test"
107 # Make sure the 10 first chunks are valid empty traces
111 # In a per-pid setup, only the first chunk is a valid trace, the other
112 # chunks should be empty folders
113 if test $per_pid = 1; then
114 validate_trace_empty
$local_path/${chunk_pattern}-1
115 nr
=$
(ls $local_path/${chunk_pattern}-2/ust |
wc -l)
117 ok $?
"Chunk 2 is empty"
118 nr
=$
(ls $local_path/${chunk_pattern}-3/ust |
wc -l)
120 ok $?
"Chunk 3 is empty"
122 while [ $i -le $expected_chunks ]; do
123 validate_trace_empty
$local_path/${chunk_pattern}-$i
This page took 0.034857 seconds and 6 git commands to generate.