-
Notifications
You must be signed in to change notification settings - Fork 0
/
sanity-run.sh
executable file
·107 lines (83 loc) · 2.96 KB
/
sanity-run.sh
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#!/bin/bash
# -*- coding: utf-8 -*-
#
# NightOwl - who tests your unit tests?
#
# Copyright (C) 2012 DResearch Fahrzeugelektronik GmbH
# Written and maintained by Erik Bernoth <bernoth@dresearch-fe.de>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version
# 2 of the License, or (at your option) any later version.
#
#-----------------------------------
# preparations
#-----------------------------------
#Where this script lies. This is import for calling the other scripts
THIS=$(dirname $0)
#where the artifacts will be stored
RES_DIR="$THIS/../build/night-owl"
mkdir -p $RES_DIR
#where to find the build logs
#alt:BUILD_LOG=$(ls -1 $THIS/../build/tmp-eglibc/cooker.log.* | sort -n | tail -1)
BUILD_LOG=$(ls -1 $THIS/../build/tmp-eglibc/log/cooker/hidav-ti81xx/*.log | sort -n | tail -1)
#where the data is stored
DB_NAME="$THIS/../build/night-owl/logging.db"
#this is how Jenkins should recognise the results as artifacts
#don't change that, if u are not familiar with Jenkins' artifacts
PRE=$RES_DIR/night-owl
#the name of the error-log File. Leave the $PRE in the beginning
ERROR_LOG=$PRE-error.log
# Name of the compiler warnigs per package log file
CC_WARNINGS_LOG=$PRE-cc-warn.log
#name of the graphi-file.
#Leave the $PRE in the beginning and no file ending needed
GRAPH_FILE=$PRE-error
#name written on top of the plot
GRAPH_NAME="Errors/Warnings per Build"
#name of the x-axis
LABEL_X="Build no."
#name of the left y-axis
LABEL_Y_LEFT="No. of Warnings"
#name of the right y-axis
LABEL_Y_RIGHT="No. of Errors"
#format string
FORMAT_WARNINGS=g--
#format string
FORMAT_ERRORS=r-o
#-----------------------------------
# here begins the action
#-----------------------------------
JOB="nightowl-job"
BUILD_NUM=$(date +%s)
[ $# -ge 1 ] && JOB="$1"
[ $# -ge 2 ] && BUILD_NUM="$2"
# Generate cumulated error log
$THIS/log_to_db.sh $BUILD_LOG $DB_NAME #new
# now paint a graph from all builds recorded so far
$THIS/sqlite_to_json.sh $DB_NAME | \
$THIS/night_owl_cli.py \
"$GRAPH_FILE" \
"$GRAPH_NAME" \
"$LABEL_X" \
"$LABEL_Y_LEFT" \
"$LABEL_Y_RIGHT" \
"$FORMAT_WARNINGS" \
"$FORMAT_ERRORS"
# Finally collect compiler warnings of all components
echo -e "\n\n--------\n $JOB $BUILD_NUM\n----" >> $CC_WARNINGS_LOG
export overall=0 count=0
find "$THIS/../build/tmp-eglibc/work/" -name 'log.do_compile' | \
{
while read file; do
num=$(grep -ci warning $file)
if [ $num -gt 0 ] ; then
name=$(echo "$file" | sed -e 's/.*tmp-eglibc\/work\/[^/]*\/\([^/]*\)\/.*/\1/')
printf "%10s warnings in %s\n" $num "$name" >>$CC_WARNINGS_LOG
overall=$((overall + num))
((count ++))
fi
done;
echo -e "\n----\nCounted $overall warnings in $count packages\n--------" >> $CC_WARNINGS_LOG;
}