| 1 |
# WEB make targets, for Libreswan |
| 2 |
# |
| 3 |
# Copyright (C) 2017-2024 Andrew Cagney |
| 4 |
# |
| 5 |
# This program is free software; you can redistribute it and/or modify it |
| 6 |
# under the terms of the GNU General Public License as published by the |
| 7 |
# Free Software Foundation; either version 2 of the License, or (at your |
| 8 |
# option) any later version. See <https://www.gnu.org/licenses/gpl2.txt>. |
| 9 |
# |
| 10 |
# This program is distributed in the hope that it will be useful, but |
| 11 |
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
| 12 |
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 13 |
# for more details. |
| 14 |
|
| 15 |
include ../../mk/dirs.mk |
| 16 |
include ../../mk/config.mk |
| 17 |
include ../../mk/testing.mk |
| 18 |
|
| 19 |
WEB_RUTDIR ?= $(TESTING_RUTDIR) |
| 20 |
WEB_SUMMARYDIR ?= $(TESTING_WEBDIR) |
| 21 |
WEB_HASH ?= $(TESTING_HASH) |
| 22 |
WEB_RESULTSDIR ?= $(TESTING_WEBDIR)/$(TESTING_RUNDIR) |
| 23 |
WEB_SUBDIR ?= $(TESTING_RUNDIR) |
| 24 |
|
| 25 |
KVM_UTILSDIR = $(abs_top_srcdir)/testing/utils |
| 26 |
|
| 27 |
# |
| 28 |
# Force the creation and/or update of the web pages |
| 29 |
# |
| 30 |
|
| 31 |
.PHONY: web |
| 32 |
web: web-summarydir |
| 33 |
web: web-resultsdir |
| 34 |
web: web-resultdir |
| 35 |
|
| 36 |
.PHONY: print-web-variable |
| 37 |
print-web-variable: |
| 38 |
@echo "$(strip $($(VARIABLE)))" |
| 39 |
|
| 40 |
.PHONY: web-publish |
| 41 |
web-publish: web-summarydir |
| 42 |
web-publish: web-resultsdir |
| 43 |
cd $(top_srcdir) && $(KVM_UTILSDIR)/kvmresults.py \ |
| 44 |
--exit-ok \ |
| 45 |
--quick \ |
| 46 |
--test-kind '' \ |
| 47 |
--test-status '' \ |
| 48 |
--publish-summary $(WEB_RESULTSDIR)/summary.json \ |
| 49 |
--publish-status $(WEB_SUMMARYDIR)/status.json \ |
| 50 |
--publish-results $(WEB_RESULTSDIR) \ |
| 51 |
--publish-hash $(WEB_HASH) \ |
| 52 |
--publish-result-html $(abs_srcdir)/result.html \ |
| 53 |
$(if $(PUBLISH_SOURCE_URL), --publish-source-url $(PUBLISH_SOURCE_URL)) \ |
| 54 |
testing/pluto |
| 55 |
|
| 56 |
%/: |
| 57 |
mkdir $* |
| 58 |
|
| 59 |
# |
| 60 |
# Build or update the web pages ready for a new test run |
| 61 |
# |
| 62 |
# For the results directory, just install the HTML / javascript files |
| 63 |
# (kvmrunner.py will fill in all the json files). For the summary |
| 64 |
# directory, do a full update so that all the previous runs are |
| 65 |
# included. |
| 66 |
|
| 67 |
.PHONY: web-test-prep |
| 68 |
web-test-prep: web-resultsdir |
| 69 |
web-test-prep: web-summarydir |
| 70 |
|
| 71 |
# |
| 72 |
# Create or update just the summary web page. |
| 73 |
# |
| 74 |
# This is a cheap short-cut that, unlike "web", doesn't update the |
| 75 |
# sub-directory's html. |
| 76 |
# |
| 77 |
|
| 78 |
.PHONY: web-summarydir |
| 79 |
web-summarydir: $(WEB_SUMMARYDIR)/commits.json |
| 80 |
web-summarydir: $(WEB_SUMMARYDIR)/tsconfig.json |
| 81 |
web-summarydir: $(WEB_SUMMARYDIR)/index.html |
| 82 |
web-summarydir: $(addprefix $(WEB_SUMMARYDIR)/, $(wildcard *.css)) |
| 83 |
web-summarydir: $(WEB_SUMMARYDIR)/favicon.ico |
| 84 |
web-summarydir: $(WEB_SUMMARYDIR)/summaries.json |
| 85 |
|
| 86 |
$(WEB_SUMMARYDIR)/index.html: summary.html | $(WEB_SUMMARYDIR)/ |
| 87 |
cp $< $@ |
| 88 |
|
| 89 |
$(WEB_SUMMARYDIR)/%.css: %.css | $(WEB_SUMMARYDIR)/ |
| 90 |
cp $< $@ |
| 91 |
|
| 92 |
$(WEB_SUMMARYDIR)/favicon.ico: favicon.ico | $(WEB_SUMMARYDIR)/ |
| 93 |
cp $< $@ |
| 94 |
|
| 95 |
# Update the pooled summary (summaries.json) of all the test runs |
| 96 |
|
| 97 |
$(WEB_SUMMARYDIR)/summaries.json: \ |
| 98 |
$(wildcard $(WEB_SUMMARYDIR)/*/summary.json) \ |
| 99 |
json-summaries.sh \ |
| 100 |
| $(WEB_SUMMARYDIR)/ |
| 101 |
: use find: can be too many files for glob |
| 102 |
: use -H: handle WEB_SUMMARYDIR being a softlink |
| 103 |
: use -maxdepth 2: no need to go below WEB_SUMMARYDIR/*/*/ |
| 104 |
find -H $(WEB_SUMMARYDIR) \ |
| 105 |
-maxdepth 2 \ |
| 106 |
-type f \ |
| 107 |
-name summary.json \ |
| 108 |
-print \ |
| 109 |
| ./json-summaries.sh $(WEB_RUTDIR) - > [email protected] |
| 110 |
mv [email protected] $@ |
| 111 |
|
| 112 |
# fudge dependency by using */summary.json |
| 113 |
$(WEB_SUMMARYDIR)/commits.json: \ |
| 114 |
$(wildcard $(WEB_SUMMARYDIR)/*/summary.json) \ |
| 115 |
gime-json-commits.sh \ |
| 116 |
gime-first-run-hash.sh \ |
| 117 |
| $(WEB_SUMMARYDIR)/ |
| 118 |
: pick up all commits unconditionally and topo sorted |
| 119 |
./gime-json-commits.sh ${WEB_SUMMARYDIR} ${WEB_RUTDIR} \ |
| 120 |
$(shell set -x ; ./gime-first-run-hash.sh $(WEB_SUMMARYDIR) $(WEB_RUTDIR)) \ |
| 121 |
| jq -s > [email protected] |
| 122 |
mv [email protected] $@ |
| 123 |
|
| 124 |
|
| 125 |
# |
| 126 |
# Create or update a test run's results page. |
| 127 |
# |
| 128 |
|
| 129 |
WEB_RESULTS_INDEX = $(sort $(WEB_RESULTSDIR)/index.html $(wildcard $(WEB_SUMMARYDIR)/*/index.html)) |
| 130 |
|
| 131 |
.PHONY: web-resultsdir |
| 132 |
web-resultsdir: $(WEB_RESULTS_INDEX) |
| 133 |
|
| 134 |
$(WEB_RESULTS_INDEX): \ |
| 135 |
$(WEB_SUMMARYDIR)/%/index.html: results.html \ |
| 136 |
| $(WEB_SUMMARYDIR)/ $(WEB_SUMMARYDIR)/%/ |
| 137 |
cp $? $(WEB_SUMMARYDIR)/$* |
| 138 |
mv $(WEB_SUMMARYDIR)/$*/results.html $(WEB_SUMMARYDIR)/$*/index.html |
| 139 |
|
| 140 |
# |
| 141 |
# generate json |
| 142 |
# |
| 143 |
|
| 144 |
web-results-json: $(WEB_RESULTSDIR)/results.json |
| 145 |
web-results-json: $(WEB_RESULTSDIR)/summary.json |
| 146 |
|
| 147 |
|
| 148 |
# |
| 149 |
# Update the html in all the result directories |
| 150 |
# |
| 151 |
# Not part of web-summarydir, web-resultsdir or web-results-html |
| 152 |
|
| 153 |
WEB_RESULTS_HTML = $(wildcard $(WEB_SUMMARYDIR)/*-g*/results.html) |
| 154 |
web-site: $(WEB_RESULTS_HTML) |
| 155 |
|
| 156 |
# |
| 157 |
# Conditional rules for building an individual test run's results |
| 158 |
# page. Requires WEB_SUMMARYDIR or WEB_RESULTSDIR. |
| 159 |
# |
| 160 |
|
| 161 |
$(WEB_RESULTSDIR)/summary.json: | $(WEB_RESULTSDIR) |
| 162 |
cd $(top_srcdir) && $(KVM_UTILSDIR)/kvmresults.py \ |
| 163 |
--exit-ok \ |
| 164 |
--quick \ |
| 165 |
--test-kind '' \ |
| 166 |
--test-status '' \ |
| 167 |
--publish-summary [email protected] \ |
| 168 |
--publish-status $(WEB_SUMMARYDIR)/status.json \ |
| 169 |
--publish-results $(WEB_RESULTSDIR) \ |
| 170 |
--publish-hash $(WEB_HASH) \ |
| 171 |
testing/pluto |
| 172 |
mv [email protected] $@ |
| 173 |
|
| 174 |
# |
| 175 |
# hack to compile json code |
| 176 |
# |
| 177 |
|
| 178 |
%/tsconfig.json: tsconfig.json.in $(wildcard *.js *.tc) | %/ |
| 179 |
sed \ |
| 180 |
-e 's;@@DEST_DIR@@;$(realpath $(dir $@));' \ |
| 181 |
-e 's;@@SOURCE_DIR@@;$(abs_srcdir);'\ |
| 182 |
tsconfig.json.in \ |
| 183 |
> [email protected] |
| 184 |
tsc --project [email protected] |
| 185 |
mv [email protected] $@ |
| 186 |
|
| 187 |
|
| 188 |
.PHONY: web-resultdir |
| 189 |
WEB_RESULT_INDEX += $(wildcard $(WEB_SUMMARYDIR)/*/*/index.html) |
| 190 |
web-resultdir: $(WEB_RESULT_INDEX) |
| 191 |
|
| 192 |
$(WEB_RESULT_INDEX): \ |
| 193 |
$(WEB_SUMMARYDIR)/%/index.html: result.html |
| 194 |
cp result.html $(WEB_SUMMARYDIR)/$*/index.html |