1
0
Fork 0
mirror of https://gitlab.alpinelinux.org/alpine/aports.git synced 2025-07-12 18:59:50 +03:00

testing/detox: run tests

This commit is contained in:
Sertonix 2025-05-12 14:51:18 +02:00 committed by Patrycja Rosa
parent e0598fd3d7
commit 5bf661ed39
2 changed files with 68 additions and 3 deletions

View file

@ -8,9 +8,11 @@ url="https://github.com/dharple/detox"
arch="all"
license="BSD-3-Clause"
makedepends="autoconf automake coreutils libtool"
checkdepends="bash check-dev musl-locales"
subpackages="$pkgname-doc"
options="!check" # no upstream/available test-suite
source="detox-$pkgver.tar.gz::https://github.com/dharple/detox/archive/v$pkgver.tar.gz"
source="detox-$pkgver.tar.gz::https://github.com/dharple/detox/archive/v$pkgver.tar.gz
tests.patch
"
prepare() {
default_prepare
@ -23,14 +25,20 @@ build() {
--sysconfdir=/etc \
--infodir=/usr/share/info \
--mandir=/usr/share/man \
--datadir=/usr/share
--datadir=/usr/share \
$(want_check && echo --with-check)
make
}
check() {
make check
}
package() {
make DESTDIR="$pkgdir" install
}
sha512sums="
a52e0f66caedce03d442dfe1f4b2f1db991c20dbc22b975c106266f1b5edcf653b22b166bbcae908c549371296c732898655002b3b95929fab5f4c03a526118f detox-2.0.0.tar.gz
9bd6c7e5637952c049eaf1fc2ef5632d94068407dea2aecaed8784f0ac864b81805d5dd167205ec239e71080fa0c80fb1ae3561367b414cb0913284b6e331fcf tests.patch
"

57
testing/detox/tests.patch Normal file
View file

@ -0,0 +1,57 @@
test_table_resize.template:118:21: error: format not a string literal and no format arguments [-Werror=format-security]
118 | ck_assert_msg(check != NULL, message);
| ^~~~~~~~~~~~~
--- a/tests/unit/test_table_resize.c
+++ b/tests/unit/test_table_resize.c
@@ -61,7 +61,6 @@
static char *table_filename = "fixtures/test_table_resize.tbl";
#define HEADER_LEN 256
-#define MESSAGE_LEN 1024
START_TEST(test_table_resize)
{
@@ -70,13 +69,11 @@
table_t *new_table;
char *check;
char *header;
- char *message;
int i, j;
int size;
int use_hash;
header = malloc(HEADER_LEN);
- message = malloc(MESSAGE_LEN);
for (use_hash = 0; use_hash <= 1; use_hash++) {
table = parse_table(table_filename);
@@ -115,22 +112,17 @@
#ifdef DEBUG
printf("\t0x%04x -> \"%s\"\n", values[j].value, check);
#endif
- snprintf(
- message,
- MESSAGE_LEN,
+
+ ck_assert_msg(
+ values[j].expected != NULL ?
+ check != NULL && strcmp(check, values[j].expected) == 0 :
+ check == NULL,
"%s, value = 0x%04X, expected = %s, output = %s",
header,
values[j].value,
values[j].expected,
check
);
-
- if (values[j].expected != NULL) {
- ck_assert_msg(check != NULL, message);
- ck_assert_msg(strcmp(check, values[j].expected) == 0, message);
- } else {
- ck_assert_msg(check == NULL, message);
- }
}
}