blob: acf62a4a013945053122a7af51f13738a1176897 [file] [log] [blame]
Daniel Lezcanobeaf7942011-09-22 16:19:39 +02001#
Daniel Lezcano35fb1722011-10-03 13:56:11 +02002# PM-QA validation test suite for the power management on Linux
Daniel Lezcanobeaf7942011-09-22 16:19:39 +02003#
4# Copyright (C) 2011, Linaro Limited.
5#
6# This program is free software; you can redistribute it and/or
7# modify it under the terms of the GNU General Public License
8# as published by the Free Software Foundation; either version 2
9# of the License, or (at your option) any later version.
10#
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with this program; if not, write to the Free Software
18# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19#
20# Contributors:
21# Daniel Lezcano <daniel.lezcano@linaro.org> (IBM Corporation)
22# - initial API and implementation
Sanjay Singh Rawated3c40c2014-04-13 12:45:22 +053023
Rajagopal Venkata2061932012-07-02 19:38:40 +053024SNT=$(wildcard *sanity.sh)
Lisa Nguyen9ecf2a02015-01-29 13:04:27 -080025TST=$(sort $(wildcard *[!{sanity}].sh))
Daniel Lezcanobeaf7942011-09-22 16:19:39 +020026LOG=$(TST:.sh=.log)
Luis Machadof7ad37f2019-01-11 15:52:52 -020027
28# Default flags passed to the compiler.
29CFLAGS?=-g -Wall
30
31# Required compiler flags to build the utils.
32FLAGS?=-pthread
33
34# Default compiler to build the utils.
Daniel Lezcano3dd53ee2012-04-05 14:03:08 +020035CC?=gcc
Luis Machadode3edfe2019-01-11 15:52:49 -020036
37# All utils' source files.
38SRC=$(wildcard ../utils/*.c) $(wildcard ../cpuidle/*.c)
39
40# All executable files built from the utils' source files.
Daniel Lezcano3dd53ee2012-04-05 14:03:08 +020041EXEC=$(SRC:%.c=%)
Daniel Lezcanobeaf7942011-09-22 16:19:39 +020042
Luis Machado6810c0a2019-01-11 15:52:54 -020043.PHONY: build_utils check clean recheck run_tests uncheck
44
Luis Machadode3edfe2019-01-11 15:52:49 -020045# Build the utils and run the tests.
46build_utils: $(EXEC)
Rajagopal Venkata2061932012-07-02 19:38:40 +053047
48SANITY_STATUS:= $(shell if test $(SNT) && test -f $(SNT); then \
Luis Machadoafefb462019-01-11 15:52:51 -020049 sudo ./$(SNT); if test "$$?" -eq 0; then echo 0; else \
Rajagopal Venkata2061932012-07-02 19:38:40 +053050 echo 1; fi; else echo 1; fi)
51
52ifeq "$(SANITY_STATUS)" "1"
53run_tests: uncheck $(EXEC) $(LOG)
Daniel Lezcanobeaf7942011-09-22 16:19:39 +020054
55%.log: %.sh
56 @echo "###"
57 @echo "### $(<:.sh=):"
58 @echo -n "### "; cat $(<:.sh=.txt);
59 @echo -n "### "; grep "URL :" ./$< | awk '/http/{print $$NF}'
60 @echo "###"
Luis Machadoafefb462019-01-11 15:52:51 -020061 -@sudo ./$< 2> $@
Rajagopal Venkata2061932012-07-02 19:38:40 +053062else
Lisa Nguyend713d632014-08-20 17:26:04 -070063run_tests:
64 ./$(SNT)
65# @cat $(<:.sh=.txt)
Rajagopal Venkata2061932012-07-02 19:38:40 +053066endif
Daniel Lezcanobeaf7942011-09-22 16:19:39 +020067
Luis Machadode3edfe2019-01-11 15:52:49 -020068# Target for building all the utils we need, from sources.
69$(EXEC): $(SRC)
Luis Machadof7ad37f2019-01-11 15:52:52 -020070 $(CC) $(CFLAGS) $(FLAGS) $@.c -o $@
Luis Machadode3edfe2019-01-11 15:52:49 -020071
Daniel Lezcanobeaf7942011-09-22 16:19:39 +020072clean:
Daniel Lezcano3dd53ee2012-04-05 14:03:08 +020073 rm -f *.o $(EXEC)
Daniel Lezcanobeaf7942011-09-22 16:19:39 +020074
Luis Machadode3edfe2019-01-11 15:52:49 -020075check: build_utils run_tests
76
Daniel Lezcano3dd53ee2012-04-05 14:03:08 +020077uncheck:
Lisa Nguyenfc2af2f2014-07-21 16:47:08 -070078 -@$(shell test ! -z "$(LOG)" && rm -f $(LOG))
Daniel Lezcanobeaf7942011-09-22 16:19:39 +020079
80recheck: uncheck check