summaryrefslogtreecommitdiff
path: root/tests/system/copy_tizen_manifest/copy_tizen_manifest.sh.template
blob: 2e52e6ead2f285fd4f55ca1be964263ea3c5222e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash

# Check the report for tizen-manifest.xml file

if [ -z "${CRASH_WORKER_SYSTEM_TESTS}" ]; then
    CRASH_WORKER_SYSTEM_TESTS="@CRASH_SYSTEM_TESTS_PATH@"
fi

. ${CRASH_WORKER_SYSTEM_TESTS}/utils/minicore-utils.sh

CRASH_MANAGER_CONF=/etc/crash-manager.conf

clean_crash_dump
clean_temp

pid=0
psout=$(ps -ewo pid,cmd | awk -v OFS=$' ' '$cmd ~ "/apps/" || $cmd ~ "org."')
if [ $(wc -l <<< "$psout") -le 1 ]; then
	skip "no run application found"
fi

while IFS=$' ' read -r pidd cmd
do
	cmd=${cmd%%[[:space:]]*}
	for VARIABLE in 1 2 #	path levels count to check
	do
		cmd=$(dirname $cmd)
		if [ -f "$cmd/tizen-manifest.xml" ]; then
			pid=$pidd
			break 2
		fi
	done
done <<< "$psout"

test $pid -ne 0 || fail "no running application has a tizen-manifest file"

kill -6 $pid

sleep 2

wait_for_app crash-manager

pushd ${CRASH_DUMP_PATH}
name=$(echo *_${pid}_*)
name=${name%.zip}

test -f "${name}.zip" || fail "crash report not found"
unzip "${name}.zip" || fail "unable to extract archive"

test -s "${name}/app/tizen-manifest.xml" || fail "tizen-manifest corrupt or not found"

for i in ${CRASH_TEMP_PATH}/*; do
    test -a "${i}" && fail "temp directory not cleaned up"
done

exit_ok