9c19e29b69dc2460d4c534b4203b48d322a719e0
1 # Clean everything under directory but keep directory
5 # Use -u from bash top prevent empty expansion of variable yielding a
6 # list of current directory from find.
8 find $path -mindepth 1 -maxdepth 1 -exec rm -rf '{}' \
;
12 function set_chunk_pattern
()
14 # Need to call this function after $today has been set.
16 # YYYYMMDDTHHMMSS[+-]HHMM-YYYYMMDDTHHMMSS[+-]HHMM
17 export chunk_pattern
="${today}T[0-9][0-9][0-9][0-9][0-9][0-9][+-][0-9][0-9][0-9][0-9]-${today}T[0-9][0-9][0-9][0-9][0-9][0-9][+-][0-9][0-9][0-9][0-9]"
20 function validate_test_chunks
()
30 # Check if the 3 chunk folders exist and they contain a ${app_path}/metadata file.
31 ls $local_path/${chunk_pattern}-1/${app_path}/metadata
>/dev
/null
32 ok $?
"Chunk 1 exists"
33 ls $local_path/${chunk_pattern}-2/${app_path}/metadata
>/dev
/null
34 ok $?
"Chunk 2 exists"
35 ls $local_path/${chunk_pattern}-3/${domain} >/dev
/null
36 ok $?
"Chunk 3 exists"
38 # Make sure we don't have anything else in the first 2 chunk directories
39 # besides the kernel folder.
40 nr_stale
=$
(\
ls $local_path/${chunk_pattern}-1 |
grep -v $domain |
wc -l)
41 ok
$nr_stale "No stale folders in chunk 1 directory"
42 nr_stale
=$
(\
ls $local_path/${chunk_pattern}-2 |
grep -v $domain |
wc -l)
43 ok
$nr_stale "No stale folders in chunk 2 directory"
45 # We expect a session of 30 events
46 validate_trace_count
$EVENT_NAME $local_path 30
49 validate_trace_count
$EVENT_NAME $local_path/${chunk_pattern}-1 10
51 # Only delete if successful
52 rm -rf $local_path/${chunk_pattern}-1
56 validate_trace_count
$EVENT_NAME $local_path/${chunk_pattern}-2 20
58 # Only delete if successful
59 rm -rf $local_path/${chunk_pattern}-2
63 # Do not check in per-pid, because the folder is really empty, no metadata
65 if test $per_pid = 1; then
66 rm -rf $local_path/${chunk_pattern}-3
68 validate_trace_empty
$local_path/${chunk_pattern}-3
70 # Only delete if successful
71 rm -rf $local_path/${chunk_pattern}-3
75 # The session folder after all chunks have been removed is empty
76 test -z "$(\ls -A $local_path)"
78 ok
$empty "Trace folder is now empty"
81 function rotate_timer_test
()
91 # Wait for $expected_chunks to be generated, timeout after
92 # 3 * $expected_chunks * 0.5s.
93 # On a laptop with an empty session, a local rotation takes about 200ms,
94 # and a remote rotation takes about 600ms.
95 # We currently set the timeout to 6 seconds for 3 rotations, if we get
96 # errors, we can bump this value.
98 until [ $nr -ge $expected_chunks ] ||
[ $nr_iter -ge $
(($expected_chunks * 2 )) ]; do
99 nr
=$
(ls $local_path |
wc -l)
100 nr_iter
=$
(($nr_iter+1))
103 test $nr -ge $expected_chunks
104 ok $?
"Generated $nr chunks in $(($nr_iter))s"
105 stop_lttng_tracing_ok
$SESSION_NAME
106 destroy_lttng_session_ok
$SESSION_NAME
110 ok $?
"Date did not change during the test"
112 # Make sure the 10 first chunks are valid empty traces
116 # In a per-pid setup, only the first chunk is a valid trace, the other
117 # chunks should be empty folders
118 if test $per_pid = 1; then
119 validate_trace_empty
$local_path/${chunk_pattern}-1
120 nr
=$
(ls $local_path/${chunk_pattern}-2/ust |
wc -l)
122 ok $?
"Chunk 2 is empty"
123 nr
=$
(ls $local_path/${chunk_pattern}-3/ust |
wc -l)
125 ok $?
"Chunk 3 is empty"
127 while [ $i -le $expected_chunks ]; do
128 validate_trace_empty
$local_path/${chunk_pattern}-$i
This page took 0.032297 seconds and 3 git commands to generate.