osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/40039?usp=email )
Change subject: testenv: refactor run --until-nok code
......................................................................
testenv: refactor run --until-nok code
Refactor the code in preparation for using the code that checks if the
testsuite was successful with a new --bisect arg in the next patch.
Change-Id: I3a8fc83c6833f0d2a8be9c0d7ddaea0546859988
---
M _testenv/testenv.py
M _testenv/testenv/testsuite.py
2 files changed, 22 insertions(+), 15 deletions(-)
Approvals:
laforge: Looks good to me, but someone else must approve
pespin: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/_testenv/testenv.py b/_testenv/testenv.py
index b9de4e8..f852c0c 100755
--- a/_testenv/testenv.py
+++ b/_testenv/testenv.py
@@ -19,17 +19,14 @@
def loop_continue_cond(loop_count):
if loop_count == 0:
return True
-
- if testenv.args.until_nok:
- logging.info("Checking testsuite logs for failures and errors")
- for match_str in ["failures='0'", "errors='0'"]:
- if not testenv.testsuite.check_junit_logs_have(loop_count - 1, match_str):
- logging.critical("Stopping the loop")
- return False
- return True
- else:
+ if not testenv.args.until_nok:
return False
+ if not testenv.testsuite.check_testsuite_successful(loop_count - 1):
+ logging.critical("Stopping the loop")
+ return False
+ return True
+
def run():
testenv.testenv_cfg.init()
diff --git a/_testenv/testenv/testsuite.py b/_testenv/testenv/testsuite.py
index a42c4e4..1cd077b 100644
--- a/_testenv/testenv/testsuite.py
+++ b/_testenv/testenv/testsuite.py
@@ -104,13 +104,23 @@
testenv.cmd.run(cmd)
-def check_junit_logs_have(loop_count, match_str):
- topdir = os.path.join(testenv.testdir.testdir_topdir, f"loop-{loop_count}")
+def check_testsuite_successful(loop_count=None):
+ topdir = testenv.testdir.testdir_topdir
+ if loop_count is not None:
+ topdir = os.path.join(topdir, f"loop-{loop_count}")
+
+ ret = True
+
for path in get_junit_logs(topdir):
- cmd = ["grep", "-q", match_str, path]
- if testenv.cmd.run(cmd, check=False).returncode:
- return False
- return True
+ for match_str in ["failures='0'", "errors='0'"]:
+ cmd = ["grep", "-q", match_str, path]
+ if testenv.cmd.run(cmd, check=False).returncode:
+ ret = False
+ break
+ if not ret:
+ break
+
+ return ret
def run(cfg):
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/40039?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I3a8fc83c6833f0d2a8be9c0d7ddaea0546859988
Gerrit-Change-Number: 40039
Gerrit-PatchSet: 2
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/40040?usp=email )
Change subject: testenv: run: add --bisect argument
......................................................................
testenv: run: add --bisect argument
Add an argument that lets testenv.py exit with != 0 when at least one
test has failed, so it can be used with "git bisect".
Change-Id: I941064c1c704560e0f7351c82e810481cd72b6da
---
M _testenv/testenv/__init__.py
M _testenv/testenv/testsuite.py
2 files changed, 11 insertions(+), 1 deletion(-)
Approvals:
laforge: Looks good to me, but someone else must approve
Jenkins Builder: Verified
pespin: Looks good to me, approved
diff --git a/_testenv/testenv/__init__.py b/_testenv/testenv/__init__.py
index 015ef24..07880cc 100644
--- a/_testenv/testenv/__init__.py
+++ b/_testenv/testenv/__init__.py
@@ -95,7 +95,14 @@
help="use binary packages from this Osmocom OBS project instead (e.g. osmocom:nightly)",
)
- group = sub_run.add_argument_group("loop options", "Run the testsuite / a single test multiple times.")
+ group = sub_run.add_argument_group("exit options", "When and how testenv should exit when done.")
+ group = group.add_mutually_exclusive_group()
+ group.add_argument(
+ "-B",
+ "--bisect",
+ action="store_true",
+ help="exit with != 0 if at least one test failed (use with git bisect)",
+ )
group.add_argument(
"-u",
"--until-nok",
diff --git a/_testenv/testenv/testsuite.py b/_testenv/testenv/testsuite.py
index 1cd077b..149e47f 100644
--- a/_testenv/testenv/testsuite.py
+++ b/_testenv/testenv/testsuite.py
@@ -177,6 +177,9 @@
merge_log_files(cfg)
format_log_files(cfg)
+ if testenv.args.bisect and not check_testsuite_successful():
+ raise testenv.NoTraceException("Testsuite failed!")
+
def get_current_test():
path = os.path.join(testenv.testdir.testdir, "testsuite/.current_test")
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/40040?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I941064c1c704560e0f7351c82e810481cd72b6da
Gerrit-Change-Number: 40040
Gerrit-PatchSet: 2
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/40032?usp=email )
(
2 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
)Change subject: buildsystem: build out-of-tree
......................................................................
buildsystem: build out-of-tree
The buildsystem used to create symlinks to dependency source files in
the testsuite directories, and then building inside that source
directory. This lead to many unrelated files being in the source
directory.
Change the logic to create symlinks to all sources in a separate
$BUILDDIR instead (default: _build) and do the build there.
Advantages:
* Source directories are not cluttered with other files anymore.
* Clean up logic becomes much simpler and faster (rm -rf _build instead
of generating a Makefile and running "make clean" in every testsuite
directory).
* No need to generate gitignore files on the fly anymore.
* Using a separate $BUILDDIR is now possible, this will be used by
testenv in a follow-up patch when running with podman, to make sure
that build artifacts from podman and not using podman are not mixed as
they are incompatible.
Related: OS#6599
Change-Id: If18aaf2a2a0d55bb617e5cb1b73f6ee4b1952494
---
M .gitignore
M Makefile
M _buildsystem/gen_links.inc.sh
M _buildsystem/regen_makefile.inc.sh
D _buildsystem/rmlinks.sh
M _testenv/testenv/testsuite.py
M start-testsuite.sh
7 files changed, 89 insertions(+), 58 deletions(-)
Approvals:
pespin: Looks good to me, approved
Jenkins Builder: Verified
laforge: Looks good to me, but someone else must approve
diff --git a/.gitignore b/.gitignore
index d1a9de5..b14e63c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -23,3 +23,4 @@
__pycache__
tags
.linux
+_build
diff --git a/Makefile b/Makefile
index 2355d9a..e490df8 100644
--- a/Makefile
+++ b/Makefile
@@ -13,6 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+BUILDDIR ?= _build
+
SUBDIRS= \
asterisk \
bsc \
@@ -87,43 +89,46 @@
deps-update: .make.deps
compile: $(foreach dir,$(SUBDIRS),$(dir)/compile)
-clean: $(foreach dir,$(SUBDIRS),$(dir)/clean)
+clean-old: $(foreach dir,$(SUBDIRS),$(dir)/clean-old)
+ @rm -rfv ~/.cache/osmo-ttcn3-testenv/podman/osmo-ttcn3-hacks
all: $(foreach dir,$(SUBDIRS),$(dir)/all)
define DIR_Makefile_template
-$(1)/Makefile: $(1)/gen_links.sh $(1)/regen_makefile.sh
+$(BUILDDIR)/$(1)/Makefile: $(1)/gen_links.sh $(1)/regen_makefile.sh
(cd $(1) && ./gen_links.sh && ./regen_makefile.sh)
endef
define DIR_compile_template
.PHONY: $(1)/compile
-$(1)/compile: deps $(1)/Makefile
- $(MAKE) -C $(1) compile
+$(1)/compile: deps $(BUILDDIR)/$(1)/Makefile
+ $(MAKE) -C $(BUILDDIR)/$(1) compile
endef
-define DIR_clean_template
-.PHONY: $(1)/clean
-$(1)/clean: $(1)/Makefile
- $(MAKE) -C $(1) clean
- (cd $(1) && ../_buildsystem/rmlinks.sh && rm Makefile)
+# Remove left-over files from before the buildsystem was changed to do
+# out-of-tree builds. _buildsystem/gen_links.inc.sh tells the users to run this
+# if needed.
+define DIR_clean_old_template
+.PHONY: $(1)/clean-old
+$(1)/clean-old:
+ @git clean -fx "$(1)"
endef
define DIR_all_template
$(1): $(1)/all
.PHONY: $(1)/all
-$(1)/all: deps $(1)/Makefile
- $(MAKE) -C $(1) compile
- $(MAKE) $(PARALLEL_MAKE) -C $(1)
+$(1)/all: deps $(BUILDDIR)/$(1)/Makefile
+ $(MAKE) -C $(BUILDDIR)/$(1) compile
+ $(MAKE) $(PARALLEL_MAKE) -C $(BUILDDIR)/$(1)
endef
$(foreach dir,$(SUBDIRS), \
$(eval $(call DIR_Makefile_template,$(dir))) \
$(eval $(call DIR_compile_template,$(dir))) \
- $(eval $(call DIR_clean_template,$(dir))) \
+ $(eval $(call DIR_clean_old_template,$(dir))) \
$(eval $(call DIR_all_template,$(dir))) \
)
-.PHONY: tags regen-diameter-types-ttcn
+.PHONY: tags regen-diameter-types-ttcn clean
tags:
find $(shell pwd) \
-type f -name "*.ttcn" -o \
@@ -132,3 +137,9 @@
regen-diameter-types-ttcn:
(cd library/ && ./regen-DIAMETER_Types_ttcn.sh)
+
+# Intentionally not using $(BUILDDIR) here to avoid user errors leading to
+# unintentional removal of other files. If $(BUILDDIR) is changed, it is
+# trivial to clean up the builddir manually.
+clean:
+ rm -rf _build
diff --git a/_buildsystem/gen_links.inc.sh b/_buildsystem/gen_links.inc.sh
index 5701f0f..161754c 100644
--- a/_buildsystem/gen_links.inc.sh
+++ b/_buildsystem/gen_links.inc.sh
@@ -1,45 +1,57 @@
-#!dont_run_this
+# Copyright 2017 Harald Welte
+# Copyright 2018-2025 sysmocom - s.f.m.c. GmbH
+# SPDX-License-Identifier: Apache-2.0
# This file is sourced by */gen_links.sh
-# Copyright 2017 Harald Welte
-# Copyright 2018 sysmocom - s.f.m.c. GmbH
-#
-# 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.
+if [ -e Makefile ]; then
+ echo
+ echo "ERROR: found old build artefacts in source tree"
+ echo
+ echo "osmo-ttcn3-hacks does out-of-tree builds now. Make sure that you"
+ echo "have comitted all code changes and run 'make clean-old' once"
+ echo "to clean up your source tree, then try again."
+ echo
+ exit 1
+fi
-rm -f .gitignore
+TOPDIR="$(realpath "$(dirname "$0")/..")"
+PROJECTDIR=$(realpath . --relative-to "$TOPDIR") # e.g. "msc", "library/rua"
+BUILDDIR="${BUILDDIR:-$TOPDIR/_build}"
-gen_link() {
- src="$1"
- f="$2"
- echo "Linking $f"
- ln -sf "$src" "$f"
- echo "$f" >> .gitignore
-}
+mkdir -p "$BUILDDIR/$PROJECTDIR"
gen_links() {
- DIR=$1
+ local f
+ local dir="$1"
shift
- FILES=$*
- for f in $FILES; do
- gen_link "$DIR/$f" "$f"
+ local files="$*"
+
+ for f in $files; do
+ (ln -sf \
+ "$(realpath "$TOPDIR/$PROJECTDIR/$dir/$f")" \
+ "$BUILDDIR/$PROJECTDIR/$f") &
done
}
gen_links_finish() {
- # Avoid using the pattern itself if no file is found in globbing below:
- shopt -s nullglob
- for pp in *.ttcnpp; do
- ttcn_file="$(echo $pp | sed 's/pp$//')"
- echo "$ttcn_file" >> .gitignore
+ local f
+ local patterns="
+ *.asn
+ *.c
+ *.cc
+ *.h
+ *.hh
+ *.ttcn
+ *.ttcnpp
+ "
+ for f in $patterns; do
+ if ! [ -e "$f" ]; then
+ continue
+ fi
+
+ ln -sf \
+ "$TOPDIR/$PROJECTDIR/$f" \
+ "$BUILDDIR/$PROJECTDIR/$f" &
done
+ wait
}
diff --git a/_buildsystem/regen_makefile.inc.sh b/_buildsystem/regen_makefile.inc.sh
index 5534ff5..497fa09 100644
--- a/_buildsystem/regen_makefile.inc.sh
+++ b/_buildsystem/regen_makefile.inc.sh
@@ -18,6 +18,12 @@
exit 1
fi
+TOPDIR="$(realpath "$(dirname "$0")/..")"
+BUILDDIR="${BUILDDIR:-$TOPDIR/_build}"
+PROJECTDIR=$(realpath . --relative-to "$TOPDIR") # e.g. "msc", "library/rua"
+
+cd "$BUILDDIR/$PROJECTDIR"
+
ttcn3_makefilegen -g -p -l -U 8 -f -e "$NAME" $FILES
sed -i -e 's/# TTCN3_DIR = /TTCN3_DIR = \/usr/' Makefile
diff --git a/_buildsystem/rmlinks.sh b/_buildsystem/rmlinks.sh
deleted file mode 100755
index 65ee03c..0000000
--- a/_buildsystem/rmlinks.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-find . -type l -delete
diff --git a/_testenv/testenv/testsuite.py b/_testenv/testenv/testsuite.py
index 9b28668..c1d048b 100644
--- a/_testenv/testenv/testsuite.py
+++ b/_testenv/testenv/testsuite.py
@@ -3,7 +3,6 @@
import atexit
import glob
import logging
-import multiprocessing
import os
import os.path
import shlex
@@ -99,11 +98,7 @@
def build():
logging.info("Building testsuite")
- testsuite_dir = f"{ttcn3_hacks_dir}/{testenv.args.testsuite}"
- testenv.cmd.run(["make", "compile"], cwd=testsuite_dir)
-
- jobs = multiprocessing.cpu_count() + 1
- testenv.cmd.run(["make", "-j", f"{jobs}"], cwd=testsuite_dir)
+ testenv.cmd.run(["make", testenv.args.testsuite], cwd=ttcn3_hacks_dir)
def is_running(pid):
@@ -173,6 +168,7 @@
cwd = os.path.join(testenv.testdir.testdir, "testsuite")
start_testsuite = os.path.join(ttcn3_hacks_dir, "start-testsuite.sh")
suite = os.path.join(ttcn3_hacks_dir, testenv.args.testsuite, section_data["program"])
+ suite = os.path.relpath(suite, ttcn3_hacks_dir)
env = {
"TTCN3_PCAP_PATH": os.path.join(testenv.testdir.testdir, "testsuite"),
diff --git a/start-testsuite.sh b/start-testsuite.sh
index 4b88501..8c55779 100755
--- a/start-testsuite.sh
+++ b/start-testsuite.sh
@@ -27,8 +27,11 @@
exit 1
fi
+TOPDIR="$(realpath "$(dirname "$0")")"
+BUILDDIR="${BUILDDIR:-$TOPDIR/_build}"
+
SUITE=$1
-SUITE_DIR="$(dirname "$SUITE")"
+SUITE_DIR="$(basename "$(dirname "$SUITE")")"
SUITE_NAME="$(basename "$SUITE")"
CFG="$SUITE_NAME.cfg"
if [ $# -gt 1 ]; then
@@ -52,9 +55,13 @@
# below is for the debian packages
TTCN3_BIN_DIR="${TTCN3_BIN_DIR:-/usr/bin}"
TITAN_LIBRARY_PATH="${TITAN_LIBRARY_PATH:-/usr/lib/titan:/usr/ttcn3/lib}"
-LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$SUITE_DIR:$TITAN_LIBRARY_PATH" "$TTCN3_BIN_DIR/ttcn3_start" $SUITE $CFG $TEST
+LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$BUILDDIR/$SUITE_DIR:$TITAN_LIBRARY_PATH" \
+ "$TTCN3_BIN_DIR/ttcn3_start" \
+ "$BUILDDIR/$SUITE_DIR/$SUITE_NAME" \
+ "$CFG" \
+ "$TEST"
-expected="$SUITE_DIR/expected-results.xml"
+expected="$TOPDIR/$SUITE_DIR/expected-results.xml"
if [ ! -f "$expected" ]; then
echo "No expected results found, not comparing outcome. ($expected)"
exit 0
@@ -67,7 +74,7 @@
exit 1
fi
-compare="$SUITE_DIR/../compare-results.py"
+compare="$TOPDIR/compare-results.py"
if [ ! -x "$compare" ]; then
echo "ERROR: cannot find $compare"
exit 1
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/40032?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: If18aaf2a2a0d55bb617e5cb1b73f6ee4b1952494
Gerrit-Change-Number: 40032
Gerrit-PatchSet: 3
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/40029?usp=email )
Change subject: buildsystem/regen_makefile: modernize
......................................................................
buildsystem/regen_makefile: modernize
Apply various small changes to make this file more readable.
Change-Id: I5a7dcd6171c6a370928ebedafc5ed318384dd8dd
---
M _buildsystem/regen_makefile.inc.sh
1 file changed, 19 insertions(+), 33 deletions(-)
Approvals:
osmith: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/_buildsystem/regen_makefile.inc.sh b/_buildsystem/regen_makefile.inc.sh
index 31dd491..5534ff5 100644
--- a/_buildsystem/regen_makefile.inc.sh
+++ b/_buildsystem/regen_makefile.inc.sh
@@ -1,19 +1,6 @@
# Copyright 2017-2019 Harald Welte
-# Copyright 2018 sysmocom - s.f.m.c. GmbH
-#
-# 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.
-
-
+# Copyright 2018-2025 sysmocom - s.f.m.c. GmbH
+# SPDX-License-Identifier: Apache-2.0
# Wrapper around the TITAN make file generator
if [ -z "$NAME" ]; then
@@ -26,16 +13,9 @@
exit 1
fi
-test -x "$(which ttcn3_makefilegen 2>/dev/null)" || { echo "ERROR: ttcn3_makefilegen not in PATH"; exit 1; }
-
-# Enable ccache if it can be found in path.
-# This speeds up repeated builds of the TTCN3 tests by an order of magnitude
-# since most of the generated C++ source files don't change very often.
-# Roughly, for an initial build which takes N minutes, a complete rebuild
-# after 'make clean' will only take N seconds with ccache.
-# Note that ccache cannot speed up compilation of .o files to .so files.
-if [ -z "$USE_CCACHE" ] && which ccache 2>/dev/null; then
- USE_CCACHE=1
+if ! command -v ttcn3_makefilegen >/dev/null; then
+ echo "ERROR: ttcn3_makefilegen not in PATH"
+ exit 1
fi
ttcn3_makefilegen -g -p -l -U 8 -f -e "$NAME" $FILES
@@ -43,31 +23,37 @@
sed -i -e 's/# TTCN3_DIR = /TTCN3_DIR = \/usr/' Makefile
sed -i -e 's/LDFLAGS = /LDFLAGS = -L \/usr\/lib\/titan/' Makefile
sed -i -e 's/LINUX_LIBS = -lxml2/LINUX_LIBS = -lxml2 -lsctp -lssl/' Makefile
-#sed -i -e 's/TTCN3_LIB = ttcn3-parallel/TTCN3_LIB = ttcn3/' Makefile
# The -DMAKEDEPEND_RUN is a workaround for Debian packaging issue,
# see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=879816 for details
sed -i -e 's/CPPFLAGS = -D$(PLATFORM)/CPPFLAGS = -D$(PLATFORM) -DMAKEDEPEND_RUN -DUSE_SCTP -DLKSCTP_MULTIHOMING_ENABLED -DAS_USE_SSL/' Makefile
-#remove -Wall from CXXFLAGS: we're not interested in generic warnings for autogenerated code cluttering the logs
+# Remove -Wall from CXXFLAGS: we're not interested in generic warnings for
+# autogenerated code cluttering the logs
sed -i -e 's/-Wall//' Makefile
-if [ "x$CPPFLAGS_TTCN3" != "x" ]; then
+if [ -n "$CPPFLAGS_TTCN3" ]; then
CPPFLAGS_TTCN3="$(echo "$CPPFLAGS_TTCN3" | tr -d '\n' | tr '\t' ' ')"
sed -i -e "s/CPPFLAGS_TTCN3 =/CPPFLAGS_TTCN3 = $CPPFLAGS_TTCN3/" Makefile
fi
-# for TITAN 6.3.0
+# For TITAN 6.3.0
if cat /etc/issue | grep "Arch Linux" >/dev/null 2>&1; then
sed -i -e 's/TTCN3_DIR = $/TTCN3_DIR = \/usr\/ttcn3/' Makefile
else
sed -i -e 's/TTCN3_DIR = $/TTCN3_DIR = \/usr/' Makefile
fi
-if [ "x$USE_CCACHE" = "x1" ]; then
- # enable ccache
+# Enable ccache if it can be found in path. This speeds up repeated builds of
+# the TTCN3 tests by an order of magnitude since most of the generated C++
+# source files don't change very often. Roughly, for an initial build which
+# takes N minutes, a complete rebuild after 'make clean' will only take N
+# seconds with ccache. Note that ccache cannot speed up compilation of .o files
+# to .so files.
+if [ "$USE_CCACHE" != 0 ] && command -v ccache >/dev/null; then
sed -i -e 's/^CXX = g++ $/CXX = env CCACHE_SLOPPINESS=time_macros ccache g++/' Makefile
- # Append the -D option to compiler flags. This option disables timestamps
- # inside comments in the generated C++ code which interfere with ccache.
+ # Append the -D option to compiler flags. This option disables
+ # timestamps inside comments in the generated C++ code which interfere
+ # with ccache.
sed -i -e 's/^COMPILER_FLAGS = \(.*\)/& -D/' Makefile
fi
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/40029?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I5a7dcd6171c6a370928ebedafc5ed318384dd8dd
Gerrit-Change-Number: 40029
Gerrit-PatchSet: 2
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>