Daniel Lezcano | beaf794 | 2011-09-22 16:19:39 +0200 | [diff] [blame] | 1 | # |
Daniel Lezcano | 35fb172 | 2011-10-03 13:56:11 +0200 | [diff] [blame] | 2 | # PM-QA validation test suite for the power management on Linux |
Daniel Lezcano | beaf794 | 2011-09-22 16:19:39 +0200 | [diff] [blame] | 3 | # |
| 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 Rawat | ed3c40c | 2014-04-13 12:45:22 +0530 | [diff] [blame] | 23 | |
Rajagopal Venkat | a206193 | 2012-07-02 19:38:40 +0530 | [diff] [blame] | 24 | SNT=$(wildcard *sanity.sh) |
Lisa Nguyen | 9ecf2a0 | 2015-01-29 13:04:27 -0800 | [diff] [blame] | 25 | TST=$(sort $(wildcard *[!{sanity}].sh)) |
Daniel Lezcano | beaf794 | 2011-09-22 16:19:39 +0200 | [diff] [blame] | 26 | LOG=$(TST:.sh=.log) |
Luis Machado | f7ad37f | 2019-01-11 15:52:52 -0200 | [diff] [blame] | 27 | |
| 28 | # Default flags passed to the compiler. |
| 29 | CFLAGS?=-g -Wall |
| 30 | |
| 31 | # Required compiler flags to build the utils. |
| 32 | FLAGS?=-pthread |
| 33 | |
| 34 | # Default compiler to build the utils. |
Daniel Lezcano | 3dd53ee | 2012-04-05 14:03:08 +0200 | [diff] [blame] | 35 | CC?=gcc |
Luis Machado | de3edfe | 2019-01-11 15:52:49 -0200 | [diff] [blame] | 36 | |
| 37 | # All utils' source files. |
| 38 | SRC=$(wildcard ../utils/*.c) $(wildcard ../cpuidle/*.c) |
| 39 | |
| 40 | # All executable files built from the utils' source files. |
Daniel Lezcano | 3dd53ee | 2012-04-05 14:03:08 +0200 | [diff] [blame] | 41 | EXEC=$(SRC:%.c=%) |
Daniel Lezcano | beaf794 | 2011-09-22 16:19:39 +0200 | [diff] [blame] | 42 | |
Luis Machado | 6810c0a | 2019-01-11 15:52:54 -0200 | [diff] [blame] | 43 | .PHONY: build_utils check clean recheck run_tests uncheck |
| 44 | |
Luis Machado | de3edfe | 2019-01-11 15:52:49 -0200 | [diff] [blame] | 45 | # Build the utils and run the tests. |
| 46 | build_utils: $(EXEC) |
Rajagopal Venkat | a206193 | 2012-07-02 19:38:40 +0530 | [diff] [blame] | 47 | |
| 48 | SANITY_STATUS:= $(shell if test $(SNT) && test -f $(SNT); then \ |
Luis Machado | afefb46 | 2019-01-11 15:52:51 -0200 | [diff] [blame] | 49 | sudo ./$(SNT); if test "$$?" -eq 0; then echo 0; else \ |
Rajagopal Venkat | a206193 | 2012-07-02 19:38:40 +0530 | [diff] [blame] | 50 | echo 1; fi; else echo 1; fi) |
| 51 | |
| 52 | ifeq "$(SANITY_STATUS)" "1" |
| 53 | run_tests: uncheck $(EXEC) $(LOG) |
Daniel Lezcano | beaf794 | 2011-09-22 16:19:39 +0200 | [diff] [blame] | 54 | |
| 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 Machado | afefb46 | 2019-01-11 15:52:51 -0200 | [diff] [blame] | 61 | -@sudo ./$< 2> $@ |
Rajagopal Venkat | a206193 | 2012-07-02 19:38:40 +0530 | [diff] [blame] | 62 | else |
Lisa Nguyen | d713d63 | 2014-08-20 17:26:04 -0700 | [diff] [blame] | 63 | run_tests: |
| 64 | ./$(SNT) |
| 65 | # @cat $(<:.sh=.txt) |
Rajagopal Venkat | a206193 | 2012-07-02 19:38:40 +0530 | [diff] [blame] | 66 | endif |
Daniel Lezcano | beaf794 | 2011-09-22 16:19:39 +0200 | [diff] [blame] | 67 | |
Luis Machado | de3edfe | 2019-01-11 15:52:49 -0200 | [diff] [blame] | 68 | # Target for building all the utils we need, from sources. |
| 69 | $(EXEC): $(SRC) |
Luis Machado | f7ad37f | 2019-01-11 15:52:52 -0200 | [diff] [blame] | 70 | $(CC) $(CFLAGS) $(FLAGS) $@.c -o $@ |
Luis Machado | de3edfe | 2019-01-11 15:52:49 -0200 | [diff] [blame] | 71 | |
Daniel Lezcano | beaf794 | 2011-09-22 16:19:39 +0200 | [diff] [blame] | 72 | clean: |
Daniel Lezcano | 3dd53ee | 2012-04-05 14:03:08 +0200 | [diff] [blame] | 73 | rm -f *.o $(EXEC) |
Daniel Lezcano | beaf794 | 2011-09-22 16:19:39 +0200 | [diff] [blame] | 74 | |
Luis Machado | de3edfe | 2019-01-11 15:52:49 -0200 | [diff] [blame] | 75 | check: build_utils run_tests |
| 76 | |
Daniel Lezcano | 3dd53ee | 2012-04-05 14:03:08 +0200 | [diff] [blame] | 77 | uncheck: |
Lisa Nguyen | fc2af2f | 2014-07-21 16:47:08 -0700 | [diff] [blame] | 78 | -@$(shell test ! -z "$(LOG)" && rm -f $(LOG)) |
Daniel Lezcano | beaf794 | 2011-09-22 16:19:39 +0200 | [diff] [blame] | 79 | |
| 80 | recheck: uncheck check |