Debian Codegraph @

third_party/rust/glean/tests/test-shutdown-blocking.sh

raw
1 #!/bin/bash
2
3 # Test harness for testing the RLB processes from the outside.
4 #
5 # Some behavior can only be observed when properly exiting the process running Glean,
6 # e.g. when an uploader runs in another thread.
7 # On exit the threads will be killed, regardless of their state.
8
9 # Remove the temporary data path on all exit conditions
10 cleanup() {
11 if [ -n "$datapath" ]; then
12 rm -r "$datapath"
13 fi
14 }
15 trap cleanup INT ABRT TERM EXIT
16
17 tmp="${TMPDIR:-/tmp}"
18 datapath=$(mktemp -d "${tmp}/glean_long_running.XXXX")
19
20 cargo run -p glean --example long-running -- "$datapath"
21 count=$(ls -1q "$datapath/pending_pings" | wc -l)
22
23 if [[ "$count" -eq 0 ]]; then
24 echo "test result: ok."
25 exit 0
26 else
27 echo "test result: FAILED."
28 exit 101
29 fi