From nobody Tue Feb 10 05:41:46 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1559038485; cv=none; d=zoho.com; s=zohoarc; b=mQwVTUPnHUByXvEpHgokTmPF/GD9+aejT0bvLdKNVKBU1j79L7jcsgbDT4WEotoICkKHUGrOBYYInN3nSIbNiK79Yusmgqb11rU9CvLwar7m1JNKySf6P5VMdVrl9s2Gn/JVeeWBVBstLC6ULgNwHKrGIxtX1AKIHQhOn1lUbRE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559038485; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=UBA4fyuukawa6NyY3EMbRa0S9sWgh2MoFLyBGNNyQyA=; b=LvJFJgdje90/nt1Zl9X5T7n0XHIwYMcW4Ax3H/HZmSb4bdjgws3W/dp1aWVgrS5h53KzAYNEnP9jL3cIXgsTBoBVLpKuPTefpII2FcNfq4JTjpYeUqLmLAXfKTM0ZJvbJoomKhFJn56DjSqzNMLWUtLHuhtw3cbOU/AH2CWNfY0= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1559038485120986.2718204678529; Tue, 28 May 2019 03:14:45 -0700 (PDT) Received: from localhost ([127.0.0.1]:60304 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hVZ7I-0000ZH-Ce for importer@patchew.org; Tue, 28 May 2019 06:14:00 -0400 Received: from eggs.gnu.org ([209.51.188.92]:43501) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hVYtf-0006Ls-Ke for qemu-devel@nongnu.org; Tue, 28 May 2019 05:59:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hVYtd-0005VU-6t for qemu-devel@nongnu.org; Tue, 28 May 2019 05:59:55 -0400 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:37423) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hVYtb-0005PW-Ke for qemu-devel@nongnu.org; Tue, 28 May 2019 05:59:53 -0400 Received: by mail-wm1-x341.google.com with SMTP id 7so2130332wmo.2 for ; Tue, 28 May 2019 02:59:49 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id a2sm7778741wrg.69.2019.05.28.02.59.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 28 May 2019 02:59:47 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 3BD1E1FFA6; Tue, 28 May 2019 10:49:55 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UBA4fyuukawa6NyY3EMbRa0S9sWgh2MoFLyBGNNyQyA=; b=xtrf85r4OW79vw7dOJQKrjKoSeq+jGnAlgTcUXIJJQ1P2Yre7PhnctD0DniKwJLLCu gbF4PsWOhvw0dhDZf8Bf1NQveNrTpYofoiGEmbRU8xqMCxoCb9DQOX/Sq/Fd/R0Y8meN 19m46I++of9x4u0xBop2/i6EHanIUyHPsm9ll2ijReA/I26gHPAiGTVbX3z0/cq8uePl yrjonziw7Dwqgv1Vi34n98JOL+Lh15JfLcXpuA1PQWWF7HqR+YZQd4fKTD7njAs9rHsy H+YSpVjBU1IHojAiFA47j8LSM5SiDY3hZuoZVnFBILI3zDp3BGeuF5xp+ROtLAx3+mQl ki2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UBA4fyuukawa6NyY3EMbRa0S9sWgh2MoFLyBGNNyQyA=; b=LwUR8neXNRVqHF/bTwPX4UFKZJQYSmsRoCojSvZgrpUXX1NMa+Of5r3trBoAlwmX0o ZZPe96xBuIgWDBw0/nn1T2uW+IPbFTysLaWYQe4+0nu6Q3pSE42AaCQsYsCKJ7UrLB/B XR4Sz6zpE9p8GE+MksB2AoSUFysNvz5qEKy/nC6JJz90KvHMMXoK6er+vuL0fa3Ooezz nILebScbKK53qRDM27sDUWnowBKFj9nf5cgW4RD6W+FNHw/VZFsxPFBDQaq6mDW+4/gK NZitaXAXw+esbivywJ9+JXTjB1wptzjP7gSIITvhCl7HuTdVZzzeZTZu5SSszpYvS2FS X4FQ== X-Gm-Message-State: APjAAAXWGIv6nR0lZLTScxCcWB3H5MQX++2BWnbMnfN7Q0MFX9qxFUut DjO15RnFo4bmxgR4gfZdpVmXceckNOM= X-Google-Smtp-Source: APXvYqzZ1ENzfYEEYIXpOd8TbK0XqEUSTxhXq1+Nj7sTkRqzVBJ1da3F0IQwwlqziI81TqwsKsGr9g== X-Received: by 2002:a1c:e90c:: with SMTP id q12mr2544688wmc.128.1559037588435; Tue, 28 May 2019 02:59:48 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Tue, 28 May 2019 10:49:45 +0100 Message-Id: <20190528094953.14898-21-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190528094953.14898-1-alex.bennee@linaro.org> References: <20190528094953.14898-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::341 Subject: [Qemu-devel] [PULL 20/28] tests/tcg/multiarch: expand system memory test to cover more X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , Richard Henderson , qemu-devel@nongnu.org, "open list:ARM" , Paolo Bonzini , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Expand the memory test to cover move of the softmmu code. Specifically we: - improve commentary - add some helpers (for later BE support) - reduce boiler plate into helpers - add signed reads at various sizes/offsets - required -DCHECK_UNALIGNED Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson diff --git a/tests/tcg/aarch64/Makefile.softmmu-target b/tests/tcg/aarch64/= Makefile.softmmu-target index cdb836f7e1e..2e560e4d08e 100644 --- a/tests/tcg/aarch64/Makefile.softmmu-target +++ b/tests/tcg/aarch64/Makefile.softmmu-target @@ -28,5 +28,7 @@ LDFLAGS+=3D-static -nostdlib $(CRT_OBJS) $(MINILIB_OBJS) = -lgcc %: %.c $(LINK_SCRIPT) $(CRT_OBJS) $(MINILIB_OBJS) $(CC) $(CFLAGS) $< -o $@ $(LDFLAGS) =20 +memory: CFLAGS+=3D-DCHECK_UNALIGNED=3D1 + # Running QEMU_OPTS+=3D-M virt -cpu max -display none -semihosting-config enable=3Do= n,target=3Dnative,chardev=3Doutput -kernel diff --git a/tests/tcg/i386/Makefile.softmmu-target b/tests/tcg/i386/Makefi= le.softmmu-target index c31bbbf39a7..e1f98177aa5 100644 --- a/tests/tcg/i386/Makefile.softmmu-target +++ b/tests/tcg/i386/Makefile.softmmu-target @@ -42,5 +42,7 @@ LDFLAGS+=3D-static -nostdlib $(CRT_OBJS) $(MINILIB_OBJS) = -lgcc %: %.c $(LINK_SCRIPT) $(CRT_OBJS) $(MINILIB_OBJS) $(CC) $(CFLAGS) $< -o $@ $(LDFLAGS) =20 +memory: CFLAGS+=3D-DCHECK_UNALIGNED=3D1 + # Running QEMU_OPTS+=3D-device isa-debugcon,chardev=3Doutput -device isa-debug-exit,= iobase=3D0xf4,iosize=3D0x4 -kernel diff --git a/tests/tcg/multiarch/system/memory.c b/tests/tcg/multiarch/syst= em/memory.c index a7a0a8e9784..dc1d8a98ff2 100644 --- a/tests/tcg/multiarch/system/memory.c +++ b/tests/tcg/multiarch/system/memory.c @@ -5,18 +5,33 @@ * behave across normal and unaligned accesses across several pages. * We are not replicating memory tests for stuck bits and other * hardware level failures but looking for issues with different size - * accesses when: - + * accesses when access is: * + * - unaligned at various sizes (if -DCHECK_UNALIGNED set) + * - spanning a (softmmu) page + * - sign extension when loading */ =20 #include +#include #include =20 -#define TEST_SIZE (4096 * 4) /* 4 pages */ +#ifndef CHECK_UNALIGNED +# error "Target does not specify CHECK_UNALIGNED" +#endif + +#define PAGE_SIZE 4096 /* nominal 4k "pages" */ +#define TEST_SIZE (PAGE_SIZE * 4) /* 4 pages */ =20 +#define ARRAY_SIZE(x) ((sizeof(x) / sizeof((x)[0]))) + +__attribute__((aligned(PAGE_SIZE))) static uint8_t test_data[TEST_SIZE]; =20 +typedef void (*init_ufn) (int offset); +typedef bool (*read_ufn) (int offset); +typedef bool (*read_sfn) (int offset, bool nf); + static void pdot(int count) { if (count % 128 =3D=3D 0) { @@ -24,17 +39,26 @@ static void pdot(int count) } } =20 +/* + * Helper macros for shift/extract so we can keep our endian handling + * in one place. + */ +#define BYTE_SHIFT(b, pos) ((uint64_t)b << (pos * 8)) +#define BYTE_EXTRACT(b, pos) ((b >> (pos * 8)) & 0xff) =20 /* - * Fill the data with ascending value bytes. As x86 is a LE machine we - * write in ascending order and then read and high byte should either - * be zero or higher than the lower bytes. + * Fill the data with ascending value bytes. + * + * Currently we only support Little Endian machines so write in + * ascending address order. When we read higher address bytes should + * either be zero or higher than the lower bytes. */ =20 -static void init_test_data_u8(void) +static void init_test_data_u8(int unused_offset) { uint8_t count =3D 0, *ptr =3D &test_data[0]; int i; + (void)(unused_offset); =20 ml_printf("Filling test area with u8:"); for (i =3D 0; i < TEST_SIZE; i++) { @@ -44,62 +68,112 @@ static void init_test_data_u8(void) ml_printf("done\n"); } =20 +/* + * Full the data with alternating positive and negative bytes. This + * should mean for reads larger than a byte all subsequent reads will + * stay either negative or positive. We never write 0. + */ + +static inline uint8_t get_byte(int index, bool neg) +{ + return neg ? (0xff << (index % 7)) : (0xff >> ((index % 6) + 1)); +} + +static void init_test_data_s8(bool neg_first) +{ + uint8_t top, bottom, *ptr =3D &test_data[0]; + int i; + + ml_printf("Filling test area with s8 pairs (%s):", + neg_first ? "neg first" : "pos first"); + for (i =3D 0; i < TEST_SIZE / 2; i++) { + *ptr++ =3D get_byte(i, neg_first); + *ptr++ =3D get_byte(i, !neg_first); + pdot(i); + } + ml_printf("done\n"); +} + +/* + * Zero the first few bytes of the test data in preparation for + * new offset values. + */ +static void reset_start_data(int offset) +{ + uint32_t *ptr =3D (uint32_t *) &test_data[0]; + int i; + for (i =3D 0; i < offset; i++) { + *ptr++ =3D 0; + } +} + static void init_test_data_u16(int offset) { uint8_t count =3D 0; - uint16_t word, *ptr =3D (uint16_t *) &test_data[0]; + uint16_t word, *ptr =3D (uint16_t *) &test_data[offset]; const int max =3D (TEST_SIZE - offset) / sizeof(word); int i; =20 - ml_printf("Filling test area with u16 (offset %d):", offset); + ml_printf("Filling test area with u16 (offset %d, %p):", offset, ptr); =20 - /* Leading zeros */ - for (i =3D 0; i < offset; i++) { - *ptr =3D 0; - } + reset_start_data(offset); =20 - ptr =3D (uint16_t *) &test_data[offset]; for (i =3D 0; i < max; i++) { - uint8_t high, low; - low =3D count++; - high =3D count++; - word =3D (high << 8) | low; + uint8_t low =3D count++, high =3D count++; + word =3D BYTE_SHIFT(high, 1) | BYTE_SHIFT(low, 0); *ptr++ =3D word; pdot(i); } - ml_printf("done\n"); + ml_printf("done @ %p\n", ptr); } =20 static void init_test_data_u32(int offset) { uint8_t count =3D 0; - uint32_t word, *ptr =3D (uint32_t *) &test_data[0]; + uint32_t word, *ptr =3D (uint32_t *) &test_data[offset]; const int max =3D (TEST_SIZE - offset) / sizeof(word); int i; =20 - ml_printf("Filling test area with u32 (offset %d):", offset); + ml_printf("Filling test area with u32 (offset %d, %p):", offset, ptr); =20 - /* Leading zeros */ - for (i =3D 0; i < offset; i++) { - *ptr =3D 0; - } + reset_start_data(offset); =20 - ptr =3D (uint32_t *) &test_data[offset]; for (i =3D 0; i < max; i++) { - uint8_t b1, b2, b3, b4; - b4 =3D count++; - b3 =3D count++; - b2 =3D count++; - b1 =3D count++; - word =3D (b1 << 24) | (b2 << 16) | (b3 << 8) | b4; + uint8_t b4 =3D count++, b3 =3D count++; + uint8_t b2 =3D count++, b1 =3D count++; + word =3D BYTE_SHIFT(b1, 3) | BYTE_SHIFT(b2, 2) | BYTE_SHIFT(b3, 1)= | b4; *ptr++ =3D word; pdot(i); } - ml_printf("done\n"); + ml_printf("done @ %p\n", ptr); } =20 +static void init_test_data_u64(int offset) +{ + uint8_t count =3D 0; + uint64_t word, *ptr =3D (uint64_t *) &test_data[offset]; + const int max =3D (TEST_SIZE - offset) / sizeof(word); + int i; + + ml_printf("Filling test area with u64 (offset %d, %p):", offset, ptr); =20 -static int read_test_data_u16(int offset) + reset_start_data(offset); + + for (i =3D 0; i < max; i++) { + uint8_t b8 =3D count++, b7 =3D count++; + uint8_t b6 =3D count++, b5 =3D count++; + uint8_t b4 =3D count++, b3 =3D count++; + uint8_t b2 =3D count++, b1 =3D count++; + word =3D BYTE_SHIFT(b1, 7) | BYTE_SHIFT(b2, 6) | BYTE_SHIFT(b3, 5)= | + BYTE_SHIFT(b4, 4) | BYTE_SHIFT(b5, 3) | BYTE_SHIFT(b6, 2) | + BYTE_SHIFT(b7, 1) | b8; + *ptr++ =3D word; + pdot(i); + } + ml_printf("done @ %p\n", ptr); +} + +static bool read_test_data_u16(int offset) { uint16_t word, *ptr =3D (uint16_t *)&test_data[offset]; int i; @@ -114,17 +188,17 @@ static int read_test_data_u16(int offset) low =3D word & 0xff; if (high < low && high !=3D 0) { ml_printf("Error %d < %d\n", high, low); - return 1; + return false; } else { pdot(i); } =20 } - ml_printf("done\n"); - return 0; + ml_printf("done @ %p\n", ptr); + return true; } =20 -static int read_test_data_u32(int offset) +static bool read_test_data_u32(int offset) { uint32_t word, *ptr =3D (uint32_t *)&test_data[offset]; int i; @@ -145,16 +219,16 @@ static int read_test_data_u32(int offset) (b2 < b3 && b2 !=3D 0) || (b3 < b4 && b3 !=3D 0)) { ml_printf("Error %d, %d, %d, %d", b1, b2, b3, b4); - return 2; + return false; } else { pdot(i); } } - ml_printf("done\n"); - return 0; + ml_printf("done @ %p\n", ptr); + return true; } =20 -static int read_test_data_u64(int offset) +static bool read_test_data_u64(int offset) { uint64_t word, *ptr =3D (uint64_t *)&test_data[offset]; int i; @@ -184,60 +258,192 @@ static int read_test_data_u64(int offset) (b7 < b8 && b7 !=3D 0)) { ml_printf("Error %d, %d, %d, %d, %d, %d, %d, %d", b1, b2, b3, b4, b5, b6, b7, b8); - return 2; + return false; } else { pdot(i); } } - ml_printf("done\n"); - return 0; + ml_printf("done @ %p\n", ptr); + return true; } =20 /* Read the test data and verify at various offsets */ -int do_reads(void) +read_ufn read_ufns[] =3D { read_test_data_u16, + read_test_data_u32, + read_test_data_u64 }; + +bool do_unsigned_reads(void) { - int r =3D 0; - int off =3D 0; + int i; + bool ok =3D true; =20 - while (r =3D=3D 0 && off < 8) { - r =3D read_test_data_u16(off); - r |=3D read_test_data_u32(off); - r |=3D read_test_data_u64(off); - off++; + for (i =3D 0; i < ARRAY_SIZE(read_ufns) && ok; i++) { +#if CHECK_UNALIGNED + int off; + for (off =3D 0; off < 8 && ok; off++) { + ok =3D read_ufns[i](off); + } +#else + ok =3D read_ufns[i](0); +#endif } =20 - return r; + return ok; } =20 -int main(void) +static bool do_unsigned_test(init_ufn fn) { - int i, r =3D 0; +#if CHECK_UNALIGNED + bool ok =3D true; + int i; + for (i =3D 0; i < 8 && ok; i++) { + fn(i); + ok =3D do_unsigned_reads(); + } +#else + fn(0); + return do_unsigned_reads(); +#endif +} + +/* + * We need to ensure signed data is read into a larger data type to + * ensure that sign extension is working properly. + */ + +static bool read_test_data_s8(int offset, bool neg_first) +{ + int8_t *ptr =3D (int8_t *)&test_data[offset]; + int i; + const int max =3D (TEST_SIZE - offset) / 2; + + ml_printf("Reading s8 pairs from %#lx (offset %d):", ptr, offset); + + for (i =3D 0; i < max; i++) { + int16_t first, second; + bool ok; + first =3D *ptr++; + second =3D *ptr++; + + if (neg_first && first < 0 && second > 0) { + pdot(i); + } else if (!neg_first && first > 0 && second < 0) { + pdot(i); + } else { + ml_printf("Error %d %c %d\n", first, neg_first ? '<' : '>', se= cond); + return false; + } + } + ml_printf("done @ %p\n", ptr); + return true; +} + +static bool read_test_data_s16(int offset, bool neg_first) +{ + int16_t *ptr =3D (int16_t *)&test_data[offset]; + int i; + const int max =3D (TEST_SIZE - offset) / (sizeof(*ptr)); + + ml_printf("Reading s16 from %#lx (offset %d, %s):", ptr, + offset, neg_first ? "neg" : "pos"); =20 + for (i =3D 0; i < max; i++) { + int32_t data =3D *ptr++; =20 - init_test_data_u8(); - r =3D do_reads(); - if (r) { - return r; + if (neg_first && data < 0) { + pdot(i); + } else if (data > 0) { + pdot(i); + } else { + ml_printf("Error %d %c 0\n", data, neg_first ? '<' : '>'); + return false; + } } + ml_printf("done @ %p\n", ptr); + return true; +} + +static bool read_test_data_s32(int offset, bool neg_first) +{ + int32_t *ptr =3D (int32_t *)&test_data[offset]; + int i; + const int max =3D (TEST_SIZE - offset) / (sizeof(int32_t)); =20 - for (i =3D 0; i < 8; i++) { - init_test_data_u16(i); + ml_printf("Reading s32 from %#lx (offset %d, %s):", + ptr, offset, neg_first ? "neg" : "pos"); =20 - r =3D do_reads(); - if (r) { - return r; + for (i =3D 0; i < max; i++) { + int64_t data =3D *ptr++; + + if (neg_first && data < 0) { + pdot(i); + } else if (data > 0) { + pdot(i); + } else { + ml_printf("Error %d %c 0\n", data, neg_first ? '<' : '>'); + return false; } } + ml_printf("done @ %p\n", ptr); + return true; +} =20 - for (i =3D 0; i < 8; i++) { - init_test_data_u32(i); +/* + * Read the test data and verify at various offsets + * + * For everything except bytes all our reads should be either positive + * or negative depending on what offset we are reading from. Currently + * we only handle LE systems. + */ +read_sfn read_sfns[] =3D { read_test_data_s8, + read_test_data_s16, + read_test_data_s32 }; =20 - r =3D do_reads(); - if (r) { - return r; +bool do_signed_reads(bool neg_first) +{ + int i; + bool ok =3D true; + + for (i =3D 0; i < ARRAY_SIZE(read_sfns) && ok; i++) { +#if CHECK_UNALIGNED + int off; + for (off =3D 0; off < 8 && ok; off++) { + bool nf =3D i =3D=3D 0 ? neg_first ^ (off & 1) : !(neg_first ^= (off & 1)); + ok =3D read_sfns[i](off, nf); } +#else + ok =3D read_sfns[i](0, i =3D=3D 0 ? neg_first : !neg_first); +#endif + } + + return ok; +} + +init_ufn init_ufns[] =3D { init_test_data_u8, + init_test_data_u16, + init_test_data_u32, + init_test_data_u64 }; + +int main(void) +{ + int i; + bool ok =3D true; + + /* Run through the unsigned tests first */ + for (i =3D 0; i < ARRAY_SIZE(init_ufns) && ok; i++) { + ok =3D do_unsigned_test(init_ufns[i]); + } + + if (ok) { + init_test_data_s8(false); + ok =3D do_signed_reads(false); + } + + if (ok) { + init_test_data_s8(true); + ok =3D do_signed_reads(true); } =20 - ml_printf("Test complete: %s\n", r =3D=3D 0 ? "PASSED" : "FAILED"); - return r; + ml_printf("Test complete: %s\n", ok ? "PASSED" : "FAILED"); + return ok ? 0 : -1; } --=20 2.20.1