summaryrefslogtreecommitdiff
path: root/tct/run/smoke_tests.sh
blob: ca8b05cb7ab0d75d87079da3d18b7c90c139ccbd (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
#!/bin/sh

# Copyright (c) 2016, 2018 Samsung Electronics Co., Ltd All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Author: Aleksander Mistewicz <a.mistewicz@samsung.com>
OPT_CRASH_PATH="/opt/usr/share/crash"
SYS_RESULT_TMP="$(mktemp)"

cat /etc/os-release

grep "Build=" /etc/info.ini
# Force crash-worker to create reports
killall dump_systemstate
echo "systemctl - system session"
systemctl --state=failed,activating | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m]//g" 2>&1 | tee "$SYS_RESULT_TMP"
echo -e "\nsystemctl - user session"
su -c 'DBUS_SESSION_BUS_ADDRESS="unix:abstract=/run/user/$UID/dbus/user_bus_socket" &&\
    XDG_RUNTIME_DIR="/run/user/$UID" && systemctl --user --state=failed,activating' - owner
uptime
echo -e "\nTOP 10 processes by cputime"
ps -eo cputime,rss,vsz,pmem,command --sort -cputime | head -n 10
sh -c "enlightenment_info -topvwins > /tmp/topvwins" &
ENLIGHTENMENT_PID="$!"
BEFORE="$(journalctl | wc -l)"
sleep 10
AFTER="$(journalctl | wc -l)"
JOURNAL_DIFF_CNT="$((AFTER - BEFORE))"
echo "Lines in journal (growth in last 10s): $AFTER ($JOURNAL_DIFF_CNT)"
ls "${OPT_CRASH_PATH}"/*
journalctl -p err | cat

kill -9 "${ENLIGHTENMENT_PID}"
cat "/tmp/topvwins"

echo SERVICES_FAIL_CNT "$(grep -c "failed" "$SYS_RESULT_TMP")"
echo JOURNAL_DIFF_CNT "$JOURNAL_DIFF_CNT"
echo JOURNAL_TOTAL_CNT "$AFTER"
echo OPT_CRASH_CNT "$(find "${OPT_CRASH_PATH}" -maxdepth 2 | wc -l)"
echo FINISH_SUCCESS