From f3ba0f816cb7144f736a914e99abdabb476f81c7 Mon Sep 17 00:00:00 2001 From: OPNA2608 Date: Thu, 9 Oct 2025 15:46:15 +0200 Subject: [PATCH] sofia_sip: Enable tests, speed up build --- .../2001-sofia-sip-Disable-some-tests.patch | 109 ++++++++++++++++++ pkgs/by-name/so/sofia_sip/package.nix | 55 ++++++++- 2 files changed, 160 insertions(+), 4 deletions(-) create mode 100644 pkgs/by-name/so/sofia_sip/2001-sofia-sip-Disable-some-tests.patch diff --git a/pkgs/by-name/so/sofia_sip/2001-sofia-sip-Disable-some-tests.patch b/pkgs/by-name/so/sofia_sip/2001-sofia-sip-Disable-some-tests.patch new file mode 100644 index 000000000000..169bcfea6949 --- /dev/null +++ b/pkgs/by-name/so/sofia_sip/2001-sofia-sip-Disable-some-tests.patch @@ -0,0 +1,109 @@ +diff --git a/libsofia-sip-ua-glib/su-glib/Makefile.am b/libsofia-sip-ua-glib/su-glib/Makefile.am +index 6f54d34..c5bfd82 100644 +--- a/libsofia-sip-ua-glib/su-glib/Makefile.am ++++ b/libsofia-sip-ua-glib/su-glib/Makefile.am +@@ -20,12 +20,12 @@ AM_CPPFLAGS = -I$(S_BASE)/su -I$(B_BASE)/su $(GLIB_CFLAGS) \ + + noinst_LTLIBRARIES = libsu-glib.la + +-check_PROGRAMS = su_source_test torture_su_glib_timer ++check_PROGRAMS = + + # ---------------------------------------------------------------------- + # Tests + +-TESTS = su_source_test torture_su_glib_timer ++TESTS = + + # ---------------------------------------------------------------------- + # Rules for building the targets +diff --git a/libsofia-sip-ua/nta/Makefile.am b/libsofia-sip-ua/nta/Makefile.am +index c450fd1..4f322c3 100644 +--- a/libsofia-sip-ua/nta/Makefile.am ++++ b/libsofia-sip-ua/nta/Makefile.am +@@ -26,9 +26,9 @@ AM_CPPFLAGS = -I$(srcdir)/../ipt -I../ipt \ + noinst_LTLIBRARIES = libnta.la + + check_PROGRAMS = check_nta test_nta_api test_nta portbind +-dist_noinst_SCRIPTS = run_test_nta_api run_test_nta ++dist_noinst_SCRIPTS = run_test_nta_api + +-TESTS = run_check_nta run_test_nta_api run_test_nta ++TESTS = run_test_nta_api + + TESTS_ENVIRONMENT = $(SHELL) + +diff --git a/libsofia-sip-ua/nua/Makefile.am b/libsofia-sip-ua/nua/Makefile.am +index 6b6dfaa..73ffd70 100644 +--- a/libsofia-sip-ua/nua/Makefile.am ++++ b/libsofia-sip-ua/nua/Makefile.am +@@ -17,8 +17,8 @@ check_PROGRAMS = + TESTS = + + if HAVE_CHECK +-check_PROGRAMS += check_nua +-TESTS += check_nua ++check_PROGRAMS += ++TESTS += + endif + + # ---------------------------------------------------------------------- +diff --git a/libsofia-sip-ua/su/Makefile.am b/libsofia-sip-ua/su/Makefile.am +index db3a331..0a31c72 100644 +--- a/libsofia-sip-ua/su/Makefile.am ++++ b/libsofia-sip-ua/su/Makefile.am +@@ -20,7 +20,7 @@ check_PROGRAMS = torture_su torture_su_port \ + torture_su_alloc torture_su_time torture_su_tag \ + test_htable test_htable2 torture_rbtree torture_heap \ + test_memmem torture_su_bm \ +- torture_su_root torture_su_timer \ ++ torture_su_timer \ + test_su su_proxy test_poll $(OSXPROGS) + + # ---------------------------------------------------------------------- +@@ -30,8 +30,8 @@ TESTS = torture_su torture_su_port \ + torture_su_alloc torture_su_time torture_su_tag \ + test_htable test_htable2 torture_rbtree torture_heap \ + test_memmem torture_su_bm \ +- torture_su_root torture_su_timer \ +- run_addrinfo run_localinfo run_test_su \ ++ torture_su_timer \ ++ run_localinfo run_test_su \ + $(OSXTESTS) + + # ---------------------------------------------------------------------- +@@ -98,7 +98,7 @@ LDADD = libsu.la + # Install and distribution rules + + EXTRA_DIST += su.docs \ +- run_addrinfo run_localinfo run_test_su ++ run_localinfo run_test_su + + dist_pkgdata_SCRIPTS = tag_dll.awk + +diff --git a/tests/Makefile.am b/tests/Makefile.am +index cabc2b5..0184017 100644 +--- a/tests/Makefile.am ++++ b/tests/Makefile.am +@@ -5,8 +5,8 @@ + # Contact: Pekka Pessi + # Licensed under LGPL. See file COPYING. + +-TESTS = test_nua +-check_PROGRAMS = test_nua ++TESTS = ++check_PROGRAMS = + + EXTRA_DIST = check_sofia.h check_sofia.c suite_for_nua.c + +@@ -33,8 +33,8 @@ libtestproxy_a_SOURCES = test_proxy.h test_proxy.c + libtestnat_a_SOURCES = test_nat.h test_nat.c test_nat_tags.c + + if HAVE_CHECK +-TESTS += check_dlopen_sofia check_sofia +-check_PROGRAMS += check_dlopen_sofia check_sofia ++TESTS += check_dlopen_sofia ++check_PROGRAMS += check_dlopen_sofia + endif + + check_sofia_CFLAGS = @CHECK_CFLAGS@ diff --git a/pkgs/by-name/so/sofia_sip/package.nix b/pkgs/by-name/so/sofia_sip/package.nix index 05c37421286b..07cea5843029 100644 --- a/pkgs/by-name/so/sofia_sip/package.nix +++ b/pkgs/by-name/so/sofia_sip/package.nix @@ -3,10 +3,15 @@ stdenv, fetchFromGitHub, fetchpatch2, + autoconf, + automake, + check, glib, + libtool, openssl, pkg-config, - autoreconfHook, + valgrind, + zlib, }: stdenv.mkDerivation rec { @@ -27,17 +32,59 @@ stdenv.mkDerivation rec { url = "https://github.com/freeswitch/sofia-sip/commit/46b02f0655af0a9594e805f09a8ee99278f84777.diff"; hash = "sha256-4uZVtKnXG+BPW8byjd7tu4uEZo9SYq9EzTEvMwG0Bak="; }) + + # Disable some failing tests + # https://github.com/freeswitch/sofia-sip/issues/234 + # run_addrinfo: Fails due to limited networking during build + # torture_su_root: Aborts with: bit out of range 0 - FD_SETSIZE on fd_set + # run_check_nta: Times out in client_2_1_1 test, which seems to test some connection protocol fallback thing + # run_test_nta: "no valid IPv6 addresses available", likely due to no networking in sandbox + # check_nua, check_sofia, test_nua: Times out no matter how much time is given to it + ./2001-sofia-sip-Disable-some-tests.patch + ]; + + # This actually breaks these tests, leading to bash trying to execute itself + # https://github.com/freeswitch/sofia-sip/issues/234 + postPatch = '' + substituteInPlace libsofia-sip-ua/nta/Makefile.am \ + --replace-fail 'TESTS_ENVIRONMENT =' '#TESTS_ENVIRONMENT =' + ''; + + strictDeps = true; + + nativeBuildInputs = [ + autoconf + automake + libtool + pkg-config ]; buildInputs = [ glib openssl ]; - nativeBuildInputs = [ - autoreconfHook - pkg-config + + nativeCheckInputs = [ + valgrind ]; + checkInputs = [ + check + zlib + ]; + + preConfigure = '' + ./bootstrap.sh + ''; + + configureFlags = [ + (lib.strings.enableFeature true "expensive-checks") + ]; + + enableParallelBuilding = true; + + doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform; + meta = with lib; { description = "Open-source SIP User-Agent library, compliant with the IETF RFC3261 specification"; homepage = "https://github.com/freeswitch/sofia-sip";