Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp6225793rwb; Mon, 14 Nov 2022 16:42:02 -0800 (PST) X-Google-Smtp-Source: AA0mqf7hUcZ4UWBb/9XvPdGJhPktvMcjKcyt1O2rOzPXFHSZHNadZjQaoGyK4xEgkkuKCXNexepj X-Received: by 2002:a62:e412:0:b0:56d:a1fc:7000 with SMTP id r18-20020a62e412000000b0056da1fc7000mr15764488pfh.35.1668472922169; Mon, 14 Nov 2022 16:42:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668472922; cv=none; d=google.com; s=arc-20160816; b=F5cr/CBAVTZT4le92mdwWy0EjXwohwVja5WyLPV9rVawhUmJMX1VZiJalmqFWAX5oQ kWpAzWmHP4tdBmJ38OrJ0VAvVB0j6UYVOgy+UHmjRcaf0d2oy+En90+gMViEwNwOQD0n xlX+6AK7Qn6Bq3d9/Fc6GH2TNyRKbvkfAtLZD/TzHXA0zVsZe+DfEzmZrDBJt54kecSN zJoV3f0sI+ZivPtuKyi8WjeJWClySQepeX+8LIdNEMupVlGWdMR0ZYeS+i+i6rjUunnD uMhCULNDHnI4ETxLs/93RXj+fK1xReZy6OXH31um9lyxrieqtj8d6j58qndBMsMBKYda 0W5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=VHrC1F4+KBRIi+HxhoVrcBzerWPZKq0dFT3HGWGGLfA=; b=M4XTxdgP+1fy/jlcAmAtDrxflUbGH0omYA/HN3m7qo2MilI+ybWiWEOYkUwVMSPF25 LW7HNfigLblHTkaxclvKZPTrHs938VFxdqdfabQxZxCIocPNSMIefBTldq93tvIUdeWI bps7qjBBj3LY8GU5/biRW54y3i2iQLoOtnaz5PxHhBExjpBPJZrD6IB0reXd41Ur1sAy 4+Nklcm2tCzN1zAHmaz8imTiBxWZ3XbR2UAOiBp2qzV2mHbBtBpeY2ERIex/EF93mNi1 K0vBuu8cBXPACAatiEVmH1jQVAIS/Hx7fIol+xs/avVEfwPn/ulWZGhq/+4lQnFLT6oU EyNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Efehzetr; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u9-20020a170902e80900b00174f3a4935fsi12165624plg.249.2022.11.14.16.41.49; Mon, 14 Nov 2022 16:42:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Efehzetr; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230251AbiKOAay (ORCPT + 99 others); Mon, 14 Nov 2022 19:30:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231379AbiKOAax (ORCPT ); Mon, 14 Nov 2022 19:30:53 -0500 Received: from mail-pg1-x533.google.com (mail-pg1-x533.google.com [IPv6:2607:f8b0:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8643ED11D for ; Mon, 14 Nov 2022 16:30:52 -0800 (PST) Received: by mail-pg1-x533.google.com with SMTP id 130so11764941pgc.5 for ; Mon, 14 Nov 2022 16:30:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=VHrC1F4+KBRIi+HxhoVrcBzerWPZKq0dFT3HGWGGLfA=; b=EfehzetrgJb3bXqNWZIPZsh3Wck0iKDlzNkHmqqy7bgHyVg4+YjTCVnCWyWVNoRHxr LZsGiQya/PFdhw9H5Sr1ruXBrNnw75WEWPYDl0LWGqq2j7ccKoOPd7Srvh+XfXZkuw61 HvWUATUfXgbs50axDf0W+n2kO9bNCieUgs6373DABC2b4EyWBcuN5dScHo2pxZ6HyaOJ vzwSfRWYYQulqyrDUI+CKFeTsnl/SyDQidikCOtTnMMdfi/XD4DNXEmAyLkafrEMlOPq O84Vuenee1Gj9svRyU++GOjW5Demubgorl51rnVdBi4CCFgm2/0jnQPKefRWdJ3mzmBm cj3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VHrC1F4+KBRIi+HxhoVrcBzerWPZKq0dFT3HGWGGLfA=; b=PhY0WeBpug2xukWxyVwhEOcVHaFPFIojncH73SpytaiA6b3mQx8Lfv62QRUjUPJC9m Y1hbNNPAU9IuONivgZuz9alUfB8MVw/XbVkGal36RoVp6QDdVppDX7G3c3k0h1qpLvJM jYLBJjdmMCPLxIUXZLnCnOyDiak3otPjzDdqwDVyKHp+lQSQ0pgYBVo8U7BeXTUEwWmW //CLuiXsHrFcSQiVmbwaGlXnqXJUtnjZcMuynBdONlodNgzX5dJLJ/nVOHyi8lxoIfA6 64g4kJMESGDizl1d75wL2+5UjHqc/eZjgNgD//XrP7f4eyt1XgR6egC5d0EsZ5u00880 +8nw== X-Gm-Message-State: ANoB5pkfdUTLR7XtDPnfxON8sbP2Ffh7qhEfxnBfsIyijMNTQnieS8rA rzNVh+eLZuOuH/CupvZpI61a/9hYOes= X-Received: by 2002:a63:310a:0:b0:46f:3a91:361c with SMTP id x10-20020a63310a000000b0046f3a91361cmr173755pgx.261.1668472245113; Mon, 14 Nov 2022 16:30:45 -0800 (PST) Received: from lvondent-mobl4.. (c-71-56-157-77.hsd1.or.comcast.net. [71.56.157.77]) by smtp.gmail.com with ESMTPSA id h3-20020a17090a3d0300b0020a28156e11sm10307888pjc.26.2022.11.14.16.30.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Nov 2022 16:30:44 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ 4/6] shared/tester: Add tester_io_set_complete_func Date: Mon, 14 Nov 2022 16:30:36 -0800 Message-Id: <20221115003038.2134340-4-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221115003038.2134340-1-luiz.dentz@gmail.com> References: <20221115003038.2134340-1-luiz.dentz@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz This adds tester_io_set_complete_func which can be used to set a callback when all iovec has been sent/received. --- src/shared/tester.c | 16 ++++++++++++++++ src/shared/tester.h | 1 + 2 files changed, 17 insertions(+) diff --git a/src/shared/tester.c b/src/shared/tester.c index e88dfabdc37c..1feaba48335c 100644 --- a/src/shared/tester.c +++ b/src/shared/tester.c @@ -89,6 +89,7 @@ struct test_case { tester_data_func_t test_func; tester_data_func_t teardown_func; tester_data_func_t post_teardown_func; + tester_data_func_t io_complete_func; gdouble start_time; gdouble end_time; unsigned int timeout; @@ -913,6 +914,9 @@ static bool test_io_send(struct io *io, void *user_data) g_assert_cmpint(len, ==, iov->iov_len); + if (!test->iovcnt && test->io_complete_func) + test->io_complete_func(test->test_data); + return false; } @@ -937,10 +941,15 @@ static bool test_io_recv(struct io *io, void *user_data) g_assert_cmpint(len, ==, iov->iov_len); + if (memcmp(buf, iov->iov_base, len)) + tester_monitor('!', 0x0004, 0x0000, iov->iov_base, len); + g_assert(memcmp(buf, iov->iov_base, len) == 0); if (test->iovcnt) io_set_write_handler(io, test_io_send, NULL, NULL); + else if (test->io_complete_func) + test->io_complete_func(test->test_data); return true; } @@ -1004,6 +1013,13 @@ void tester_io_send(void) io_set_write_handler(ios[1], test_io_send, NULL, NULL); } +void tester_io_set_complete_func(tester_data_func_t func) +{ + struct test_case *test = tester_get_test(); + + test->io_complete_func = func; +} + int tester_run(void) { int ret; diff --git a/src/shared/tester.h b/src/shared/tester.h index c28f61e7fd6b..49610185a444 100644 --- a/src/shared/tester.h +++ b/src/shared/tester.h @@ -78,3 +78,4 @@ void tester_wait(unsigned int seconds, tester_wait_func_t func, struct io *tester_setup_io(const struct iovec *iov, int iovcnt); void tester_io_send(void); +void tester_io_set_complete_func(tester_data_func_t func); -- 2.37.3