So far we were executing all our TTCN-3 tests from a container
image with Debian stretch (9) plus a custom more recent eclipse-titan
package from the osmocom feed.
Let's update the container base OS from stretch (9) to bullseye (11)
while using the same packaged eclipse-titan version (8.0.0) for running
the tests. So this should be a low-risk change, as titan runtime
I've executed all test suites locally and couldn't see any regressions.
This enables the test suite to obtain talloc reports between the
test case executions, which get stored together with the PCAP files.
Write a line like 'Misc_Helpers.mp_osmo_repo := "nightly"' into the
TTCN-3 config file (e.g. BSC_Tests.cfg), before starting the testsuite.
This allows executing different code paths in the tests based on the
Disable KVM if /dev/kvm is missing, as it is apparently the case on our
jenkins nodes. This makes the tests run a bit slower, but not much. Add
kernel_test_wait_for_vm to sleep until the VM is booted up (~5s instead
of ~1s without KVM), so the first test in the testsuite does not fail
when using KVM.
The variable is useful to test the non-KVM code path even if KVM is
available on the host.
Make it possible to run ttcn3-ggsn-test against osmo-ggsn with the GTP
kernel module. This feature is enabled by environment variables
explained in ttcn3-ggsn-test/jenkins.sh, and can either use the
pre-built kernel from Debian, or build a kernel from source.
The kernel runs inside QEMU inside the usual osmo-ggsn-master docker
Thanks to Pau for providing the kernel config and kernel-test scripts
that this patch is based on! I ended up modifying them quite a bit to
fit the docker use case, and to build the initrd (so we can use the
stock debian kernel).
Abort the script and trigger the clean up script, whenever any of the
commands below to prepare the testsuite are failing. This saves time
with figuring out why suddenly all or most tests are failing, and avoids
running the entire testsuite on jenkins if it's obviously not going to
Add set_clean_up_trap() in jenkins-common.sh and run it at the beginning
of the jenkins.sh files. Move the common clean up code from the end of
every jenkins.sh file into clean_up_common(), which gets called by the
trap. Add a custom clean_up() function to those jenkins.sh files that
need additional clean up.
Replace explicit container stop commands (for containers attached to the
docker network) with one call to network_clean() in clean_up_common(). It
kills all containers attached to the docker network.
The motivation for this change is the upcoming optional build of initrd
and kernel during ttcn3-ggsn-test/jenkins.sh. After building these, a
short smoke test will be performed to make sure we can boot the kernel
and initrd, before continuing to run the entire testsuite against it. If
building or the smoke test fails, we must do a proper clean up of the
network and fix permissions.
Allow jenkins to fetch the image from our private docker registry.
Outside of jenkins, the image is built locally just like before.
Move the git fetch/checkout code and make call to build the testsuite,
to debian-stretch-titan/ttcn3-docker-prepare.sh. In the next patch, I
will extend the script to update deps right before building too (e.g.
because OSMO_TTCN3_BRANCH changed).
Clone the osmo-ttcn3-hacks and all dependency repositories less often by
moving related commands to the shared debian-stretch-titan image.
Remove the 'git checkout -f -B master origin/master' line, because the
master branch is checked out by default.
While at it, move the shared "git config" commands too, and move them
before cloning the repositories, so they don't run again whenever the
deps change (logic to invalidate the cache if deps change will be added
in the next patch).
We cannot rely on every test slave always having proper IPv6
conenctivity to a public DNS server, and that DNS server to respond
to ICMPv6 echo request. We're testing half of the internet instead
of our GGSN. Let's use the IPv6 address of the docker container
running the test sute, which is guaranteed to always exist. We have
no problems with routing, as the ICMPv6 is hand-crafted and encapsulated
into GTP before it's sent to the kernel IP stack - so basically on the
transmit side, the kernel doesn't know anything about the destination
address of the encapsulated IPv6 packet.
We previously only allocated IPv4 sub-nets to the network segments
created with 'docker network'. Let's fix that by assigning both
IPv4 and IPv6 address ranges to each docker network.
Don't list debian-stretch-build and debian-stretch-titan as dependencies
anymore, now that docker_images_require finds them automatically.
Allow to pass options to each "docker run" line in the various
jenkins.sh scripts. I'm using this to run the testsuites and Osmocom
components in docker with the same configurations as jenkins, but with
Osmocom and testsuite binaries built outside and mounted into the
DOCKER_ARGS="-v /usr/local:/usr/local:ro -v $hacks:/osmo-ttcn3-hacks:ro"
This allows very short test cycles without a second set of configs. The
full script that makes use of this feature is in osmo-dev.git,
Replace 'git checkout -f -B $BRANCH origin/$BRANCH && \' in all
Dockerfiles that accept branch variables ($OSMO_TTCN3_BRANCH,
$OSMO_MGW_BRANCH, ...) with the following:
git checkout $BRANCH && \
(git symbolic-ref -q HEAD && git reset --hard origin/$BRANCH || exit 1); \
This allows using branch names and commit hashes in the $BRANCH
variables. Using commits is needed for the bisect script added in .
The second line ("(git symbolic...") checks if we are in detached HEAD
state after the checkout, and if we are not, pulls in all new commits
from origin/$BRANCH. Note that it ends in ';' instead of '&&', because
the command in the next line should be executed even if
"git symbolic-ref" does not exit with 0 (detached HEAD state).
Here is an example, to illustrate that the new command does the right
thing. Clone a repository and be 50 commits behind origin/master:
$ git clone "https://git.osmocom.org/osmo-mgw"
$ cd osmo-mgw
$ git reset --hard origin/master~50
$ git checkout master && \
(git symbolic-ref -q HEAD && git reset --hard origin/master || exit 1); \
Already on 'master'
$ git status
Your branch is up-to-date with 'origin/master'.
$ git checkout 85978d && \
(git symbolic-ref -q HEAD && git reset --hard origin/85978d || exit 1); \
Note: checking out '85978d'.
$ git status
HEAD detached at 85978dad
Related previous changes:
*  made it work for commit hashes, but broke using branch names other
than master, and pulling in new commits from master
*  made branches other than master work again, but did not fix
pulling in new commits from master
*  reverted  and the git checkout related part from 
 Change-Id: I11f7e61a9b30d58a0fdfcaf77dde447806bf661f
 Change-Id: If3bc5fae07cf63c4fef68306be4c4328660bc869
 Change-Id: I2ff745c8d19b777d876170d5717c082ceb68a1f3
 Change-Id: Ie6da0f9ea96f11407e38545a6b3cf22ef9cadc25
Unfortuately this commit will check out *local* master (i.e. the
previous checkout) rather than the origin/master as it's supposed to
be. This means that ever since merging this patch, our ttcn3 tests
were running some "undefined" stale versions and not current master.
This reverts commit 26565bb729.
Replace the following statements:
a) "git checkout -f -B $BRANCH origin/$BRANCH"
b) "git checkout -f -B $BRANCH $BRANCH"
c) "git checkout -f $BRANCH"
Regarding a), we don't need to specify 'origin/' for each branch, since
we are cloning the repositories in the same Dockerfile, and therefore we
know for sure that there is only one remote and branch names won't be
ambiguous. Removing the 'origin/' allows to put commit hashes into the
branch variables (like done in the new bisect script ).
Version b) does not work with branch names:
$ git checkout -f -B osmith/check-imei-before-lu osmith/check-imei-before-lu
fatal: Cannot update paths and switch to branch 'osmith/check-imei-before-lu' at the same time.
Did you intend to checkout 'osmith/check-imei-before-lu' which can not be resolved as commit?
New version c) works with both commits and branches, and it is shorter.
 Change-Id: I11f7e61a9b30d58a0fdfcaf77dde447806bf661f
Default value "master" of the IMAGE_SUFFIX environment variable can be
changed to "latest" to test the latest stable builds instead of the
nightly ones. Use docker_images_require() to make sure that the required
images are existing and up-to-date before running the tests.
Instead of hardcoding laforge's username in all FROM statements in the
Dockerfiles, make use of the USER variable (as passed through by the
"make/Makefile" with "docker build --build-arg USER=..."). Thanks to
fixeria for proposing this fix!
This requires running docker-ce, old versions of docker (such as the
one in the official repositories of the latest Fedora) don't support
variables in the FROM line. But docker-ce can be installed after
adding docker's 3rd party repositories.
Previous to this commit, log messages were not being merged if tests
were resolved as failed (test-suite.sh ending with exit code != 0),
which can happen if at least one test failed.
Do not brush over VOL_BASE_DIR with a new temp dir, since jenkins-common.sh has
already figured out where these should run.
Should fix jenkins job build failures for mgw and ggsn, after the merge of
In Change-Id: I1dc299407c61b1c865035add44067b8ab89001b3
a VTY interface was added to osmo-ttcn3-hacks.git, but
it was missed to update the config file here for the dockerized
execution, rendering us with broken test builds ever since.
To remove code dup and prepare a change to where logs are written, add
collect_logs() to jenkins_common.sh and call that from each jenkins.sh after
the tests are done.
The 'rm -rf' is already done before a test starts. No need to do that again
after each test.