Add the process ID at the end of the log file that ttnc3 writes, to avoid potential conflicts:
> Otherwise if you have eg TC_foobar in STP_Tests_M3UA and > STP_Tests_IPA, you may end up rewriting one of them since both would be > written with the same file name.
%e is the name of the TTCN-3 executable, e.g. STP_Tests even if the test case is in STP_Tests_M3UA. It is not possible to get STP_Tests_M3UA into the file name with any of the meta characters, I've tried it out.
In some testsuites we have tests in ttcn3 files other than the main testsuite executable. In that case we save the pcap files with the name of the ttcn3 file with the test, but before this patch the merged log file has the name of the main testsuite. This is inconsistent and may lead to a conflict if a test exists in multiple ttcn3 files.
Fix this by getting the same prefix as we use for the pcap from the logfile itself. Fall back to using the same prefix as without this patch in case we can't parse the log line.
stp: Update TC_rkm_unreg_active to expect multiple routing contexts
That test is registering a new routcing context (AS) into an existing/pre-configured ASP. As a result, the ASP serves 2 AS. When we receive notifications on that ASP then we'll be receiving info on 2 routing contexts, one for the pre-confgiured AS and one for the dynamically registered one.
When running with --podman --binary-repo and a testsuite needs a component for which we don't have a binary package (such as sccp_demo_user), we need to clone the source and build it.
Show the commit from which we are building / have already built the component.
* Do not run them in podman: git is required to run testenv, by not running it through podman the command in the log is shorter. * Set advice.detachedHead=false for the git clone to avoid printing the "You are in 'detached HEAD' state. You can look around ..." text block that isn't useful in this context.
Without this patch qemu_initrd_add_file fails to add kernel modules with "No such file or directory" when running in podman, even though the files exist:
./testenv.py run ggsn -Dp -c osmo_ggsn_v4_only … + cp -a --parents /lib/modules/6.1.0-34-amd64/kernel/drivers/net/net_failover.ko /tmp/testenv-ggsn_tests-osmo_ggsn_v4_only-20250509-1146-cd82caba-wegi5i98/ggsn/_initrd/usr cp: 'lib/modules/6.1.0-34-amd64/kernel/drivers/net': No such file or directory …
When looking at it with strace it became clear that this comes from a getxattr that fails in the podman filesystem and returns a misleading error:
getxattr("lib/modules/6.1.0-34-amd64/kernel/drivers/net", "system.posix_acl_access", 0x7ffc012054e0, 132) = -1 ENOENT (No such file or directory)
Fix it by modifying the cp command to not try to preserve any attributes (they don't matter in the initramfs).
Without this patch the build_initrd function keeps going on errors:
+ cp -a --parents /lib/modules/6.1.0-34-amd64/kernel/drivers/net/net_failover.ko /tmp/testenv-ggsn_tests-osmo_ggsn_v4_only-20250509-1040-a21668df-euc9e2fs/ggsn/_initrd/usr cp: 'lib/modules/6.1.0-34-amd64/kernel/drivers/net': No such file or directory + cp -a --parents /lib/modules/6.1.0-34-amd64/kernel/drivers/net/virtio_net.ko /tmp/testenv-ggsn_tests-osmo_ggsn_v4_only-20250509-1040-a21668df-euc9e2fs/ggsn/_initrd/usr …
The reason for that is that even though the script runs with set -e, the -e flag gets ignored between if…then where the build_initrd shell function gets called:
if ! build_initrd >build_initrd.log 2>&1; then qemu_initrd_exit_error "build_initrd.log" fi
Fix loading the sctp module, which is needed to run osmo-epdg in QEMU: modprobe: can't load module libcrc32c (kernel/lib/libcrc32c.ko): unknown symbol in module, or unknown parameter
Make it possible to set qemu=required in addition to the existing possibility of qemu=optional in the testenv configs and verify that either the debian kernel (from the podman container) or a custom kernel gets used for such configs.
This is in preparation for adding a testenv config for osmo-epdg, which uses kernel-gtp and unlike osmo-ggsn doesn't have userspace fallback code. With testenv using the hosts gtp kernel device for this is not supported (it would have several downsides anyway, such as not being in control what exact kernel version is used leading to different test outcomes for different users, not being easily able to compare different kernel versions, having a harder time getting debug logs from the module etc.).
Erlang has its own library loading mechanism, so we need to explicitly add the depending libraries to the initramfs instead of just pointing at binaries.
Pau ran into an unexpected bug while having entries in copy= separated by multiple spaces ("copy=osmo-stp.cfg osmo-stp-m3ua.confmerge"):
[testenv][m3ua] + ['cp', '-a', 'osmo-stp.cfg', '', 'osmo-stp-m3ua.confmerge', '/tmp/testenv-stp-m3ua-20250516-1349-e4103924-bfvi_syt/stp'] cp: cannot stat '': No such file or directory
Catch this early and print a more useful error:
[testenv] /home/user/code/osmo-dev/src/osmo-ttcn3-hacks/stp/testenv.cfg: copy= in section [stp] has multiple spaces: [testenv] "osmo-stp.cfg osmo-stp-m3ua.confmerge" [testenv] Please separate elements with only one space.
The previous name usually causes confusion since it seems to indicate either: * Some sort of common placeholder for STP_Tests_IPA and STP_Tests_M3UA (it's not the case, we already have STP_Tests_Common.ttcn for that) * A placeholder for tests not IPA or M3UA related (it's not the case, since it only contains IPA<->M3UA tests).
Hence, rename it to denote better the aim of that file, ie. testing forwarding between IPA and M3UA AS(P)s.
epdg: add sleep to f_TC_hss_initiated_deregister_permanent_termination
The test sends PERMANENT_TERMINATION twice to osmo-epdg. If we don't sleep between them, osmo-epdg is not able to terminate related FSMs quickly enough between the first and the second termination request when running in QEMU, which results in osmo-epdg answering with DIAMETER_SUCESS instead of DIAMETER_ERROR_USER_UNKNOWN for the second f_DIA_SWx_RT.
epdg: TC_concurrent_ues_MTC: rx CMD_ATTACHED without from vc_conn_list[i]
This is needed to make the test pass in QEMU. I think this makes it accept the COORD_CMD_ATTACHED in any order instead of the order the COORD_CMD_START were sent beforehand.
Increasing the sleep between the COORD_CMD_START also makes the test pass in QEMU, but that increases the overall test time significantly in TC_concurrent_ues100.
The osmocom:latest repository currently has eclipse-titan 9.0.0 and we assume that the user has at least this version installed. Add a check to avoid subtle unexpected errors caused by using older versions.
stp: Split M3UA TCP tests into its own testenv config
That group of tests explicitly tests operation of m3ua-tcp AS(P)s and interaction with m3ua(-sctp) ones. Hence, create a new config to test those, where we keep the TCP related configuration in osmo-stp.
NGAP_Templates: Fix criticality of PLMNSupportList IE in NGSetupResponse
The criticality rejected is specified in 3GPP TS 38.413 version 18.5.0 Release 18, both in the ASN.1 definition of "NGSetupResponseIEs NGAP-PROTOCOL-IES", as well as section 9.2.6.2. open5gs-amfd is correctly sending reject there.
testenv: podman: Stick rebar3 downloaded version to 3.24.0
The previous URL now contains a newer 3.25.0 rebar3 release, which requires minimum OTP 26, but debian12 launches with OTP 25.
""" This BEAM file was compiled for a later version of the runtime system than the current (Erlang/OTP 25). To fix this, please re-compile this module with an Erlang/OTP 25 compiler. (Use of opcode 182; this emulator supports only up to 180.) """
Allow building with less than all CPU cores. This may be desirable because the NGAP asn1 files are huge and building with -j$(NPROC) eats all the memory on some systems.
Generate the osmo-dev make dir path in one location, in testenv.cmd which gets imported by testenv.osmo_dev instead of doing it in both. This makes it easier to bump make_dir_version when necessary.
When osmo-dev is used (no --binary-repo arg is set), then set TESTENV_INSTALL_DIR and --install-prefix for osmo-dev to: <cache dir>/osmo-ttcn3-testenv/{podman,host}/install Old --install-prefix: <cache dir>/osmo-ttcn3-testenv/{podman,host}/usr Old TESTENV_INSTALL_DIR: <cache dir>/osmo-ttcn3-testenv/{podman,host}
The old behavior was misleading, because: * It resulted in configs getting installed into: <cache dir>/osmo-ttcn3-testenv/{podman,host}/usr/etc/... * TESTENV_INSTALL_DIR looked like it would point at the install dir (because there is usr inside that directory), but it was actually pointing at the top dir of the install dir.
log_merge.sh: Merge all logs if no test cases are found
This can happen for instance if titan exits with an error during startup even before starting any test. In that scenario, titan still writes stuff to a file (eg. C5G_Tests--efc28eab6a6d-hc-1305.log). Let's try to make everything logged available in that case, so user can debug what went wrong.
deps: Depend on osmocom fork of forge.etsi.org nas.git
This module provides types, templates and functions to operate NG NAS (5G).
A fork is needed because: * Upstream code doesn't compile against eclipse titan (A PR has been submitted upstream and we should eventually be able to compile ttcn3 code just fine in that regard). * Some system/external functions need to be implemented, such as fx_GetSystemTime(). We currently do that in our fork.
The previous logic of not always running "make deps" was useful when "make deps" would take a long time to complete even if there were no changes. But this has been fixed in c7e40d6a ("Makefile: avoid fetching deps if not needed"). Run it every time now in order to fix that deps are not updated after deps/Makefile gets changed.
With this patch it is already possible to transmit the NAS Auth Response in the test ConnHdlr. We still lack generating a proper RES to have the response properly accepted.
testenv: podman: Install newer libcurl from bookworm-backports
It was already spotted a few days ago that libcurl4 7.88.1-10+deb12u12, currently being shipped by debian12, contains some sort of bug where it doesn't properly format/read HTTP2 requests when used in open5gs. It was found out that installing a newer version of libcurl4 fixes the problem. This patch also fixes the problems spotted in the 5gc testsuite when running within podman (they didn't show up outside podman because I'm using Archlinux and hence using newer libcurl 8.13.0 too).
Install eclipse-titan from osmocom:nightly instead of osmocom:latest, which now has version 11. Once we ensured everything works as expected, we will upgrade the version in osmocom:latest too.