From bac46e9eb645e823fcf8f13efd84820a3a4c07ec Mon Sep 17 00:00:00 2001 From: Sertonix <sertonix@posteo.net> Date: Tue, 14 Jan 2025 13:24:55 +0100 Subject: [PATCH] community/asterisk-chan-dongle: run tests --- community/asterisk-chan-dongle/APKBUILD | 8 ++++++++ community/asterisk-chan-dongle/big-endian.patch | 17 +++++++++++++++++ community/asterisk-chan-dongle/tests.patch | 13 +++++++++++++ 3 files changed, 38 insertions(+) create mode 100644 community/asterisk-chan-dongle/big-endian.patch create mode 100644 community/asterisk-chan-dongle/tests.patch diff --git a/community/asterisk-chan-dongle/APKBUILD b/community/asterisk-chan-dongle/APKBUILD index 3c6fb8c1bf26..30c4bf0e41c0 100644 --- a/community/asterisk-chan-dongle/APKBUILD +++ b/community/asterisk-chan-dongle/APKBUILD @@ -13,6 +13,8 @@ makedepends="asterisk-dev autoconf automake sqlite-dev" provides="asterisk-dongle=$pkgver" source="$pkgname-$pkgver.tar.gz::https://github.com/wdoekes/asterisk-chan-dongle/archive/$_commitid.tar.gz fix-autodisc.patch + tests.patch + big-endian.patch " builddir="$srcdir/$pkgname-$_commitid" @@ -33,6 +35,10 @@ build() { make } +check() { + make check +} + package() { mkdir -p "$pkgdir"/usr/lib/asterisk/modules "$pkgdir"/etc/asterisk install -m644 etc/dongle.conf "$pkgdir"/etc/asterisk/dongle.conf.sample @@ -42,4 +48,6 @@ package() { sha512sums=" b0f05a16a12fee210a0e35b8dd538c5a4983fc0a484a39b20cc56636a979081fb9b1c47e4fa6d0d5f2e5c9e58f27591e3f44e8592a4f77548899f06dd99eafa1 asterisk-chan-dongle-1.1.20211005.tar.gz 84488b208113760f5c7fc8eed3a5206e4d9b175267508fd370e028dbc15dc4f525f9df98c673df059c12f62253c79ae13609e5d6d4e5effa7b3f972b38417b3e fix-autodisc.patch +6bd5298dd6d11bf58b2a89940e6af89eaa6ff44fddc0ac8b9a13f6debe9b6f5c9f001af9c8a3611ef744adff0c35d300203661abdb9f0bfcb73817aeb18971f1 tests.patch +ebd89c185c224c4471cec5a1ef723be572a3c95e019715408a948c5b24acdec82317c3ece580fbaaabd4616a90bf2cb7dd28771bbe1376d877f5a611c1d72905 big-endian.patch " diff --git a/community/asterisk-chan-dongle/big-endian.patch b/community/asterisk-chan-dongle/big-endian.patch new file mode 100644 index 000000000000..605190718949 --- /dev/null +++ b/community/asterisk-chan-dongle/big-endian.patch @@ -0,0 +1,17 @@ +--- a/char_conv.c ++++ b/char_conv.c +@@ -132,7 +132,13 @@ EXPORT_DEF ssize_t gsm7_encode(const uint16_t *in, size_t in_length, uint16_t *o + { + // TODO: Should we check for other tables or just use UCS-2? + unsigned bytes = 0; +- const uint8_t *escenc = get_char_gsm7_encoding(0x1B00); ++ const uint8_t *escenc = get_char_gsm7_encoding( ++#if __BYTE_ORDER == __BIG_ENDIAN ++ 0x001B ++#else ++ 0x1B00 ++#endif ++ ); + for (unsigned i = 0; i < in_length; ++i) { + const uint8_t *enc = get_char_gsm7_encoding(in[i]); + uint8_t c = enc[0]; diff --git a/community/asterisk-chan-dongle/tests.patch b/community/asterisk-chan-dongle/tests.patch new file mode 100644 index 000000000000..2e481e593921 --- /dev/null +++ b/community/asterisk-chan-dongle/tests.patch @@ -0,0 +1,13 @@ +Fix tests + +--- a/test/parse.c ++++ b/test/parse.c +@@ -192,7 +192,7 @@ + uint16_t buf16[256]; + int res = utf8_to_ucs2(inin, strlen(inin), buf16, 256); + res = gsm7_encode(buf16, res, buf16); +- int packedsize = gsm7_pack(buf16, res, (char*)pdu, res * 2, j); ++ int packedsize = gsm7_pack(buf16, res, (char*)pdu, 256, j); + hexify(pdu, (packedsize + 1) / 2, (char*)pdu); + res = unhex((const char*)pdu, pdu); + res = gsm7_unpack_decode((const char*)pdu, packedsize, buf16, res, j, 0, 0); -- GitLab