Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4806966rdb; Fri, 15 Sep 2023 12:54:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHPP6U1Rq5ZPUOoWScA1zNYAXVp9++nQFMtnX7mkeRyGWFyFfXekqxY1uc1gvjj18BU/ql3 X-Received: by 2002:a17:90a:8c0e:b0:268:37b:a10e with SMTP id a14-20020a17090a8c0e00b00268037ba10emr2583176pjo.11.1694807662456; Fri, 15 Sep 2023 12:54:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694807662; cv=none; d=google.com; s=arc-20160816; b=OYh2aSUN5WBKO7w+hTJuVVgKbBuFs9+OqKnoXw1uV1EmsScySHMBNu3IrvWaveNxul XjQMpq0mcLdpHXqenYzggiNEoUbMHpiwIKaMGBjSpWks9WrzOLKJhyrIfFHa4WOQA6Gs HS2lHBO3oTHR5CQKMR0oDKbn/BsOpMeBSdV6tRCzWU/PocGRcBoqBwu7rUNHFRHHJeo3 JVsDpRnm9UCrYWAC18CAPdzT944LcEaBh0x1RLNv+vl6BmBXRNBE1fok69yLfWqUdJRT +Z3/2F/bTW/zffMtMjvm1saizCE4eXcVfqMynPSuHNSn/0yzk9p3n/fAeUksm94i+/qK TUww== 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:cc:to:from :dkim-signature; bh=4IzPTIpBjDzBGvsyRo0gBVOG837dBZudcrNhelcBAVs=; fh=J/Tdp6DUamc8sA1HTuiwIDZYTQ3lnfVGKPrVMKro77Q=; b=0MzAaYxiwuIHbzgUrf2HULyxcYNu31zZzjj9orkQWsn7xfJv0jFrLi0ESwVk35RHbJ GR6tWC11k0KTdkOPd0J+92ekSBw0GsUHtRYz0T3RQpxgi3wFcT6RyHkAgkPOlKzAX0Jc 1ZetlBmFMICddxdgVzBHsdFI6TDbYZmAo+j2ovy8gnIKvN2cCDm7g0VKYdfQ6jVA4WFJ EdY/hW1MdEuKYsArfj+lVT7zHwYAlXSUBqLazzBVdVz4bl6/BJPgBKkrJXrr9oTQlG4h W08DT17jRdO1Wl/QPWvYzK3ePVPGpHOzKxr91iKQBnv2MkPvXqP5Fd7+eT0oSpA4L2Z3 YudQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dfvMqVfy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id ng7-20020a17090b1a8700b0026376acd6fesi4127264pjb.22.2023.09.15.12.54.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 12:54:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dfvMqVfy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 0C4A48415026; Fri, 15 Sep 2023 05:16:44 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234788AbjIOMQ3 (ORCPT + 99 others); Fri, 15 Sep 2023 08:16:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234777AbjIOMQ1 (ORCPT ); Fri, 15 Sep 2023 08:16:27 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2DD9F2715 for ; Fri, 15 Sep 2023 05:15:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1694780129; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4IzPTIpBjDzBGvsyRo0gBVOG837dBZudcrNhelcBAVs=; b=dfvMqVfyvQ0j6+M3Q7eswFMUxV/FXBnVNAmiIBTTC/soC7XJegtOsAmbNCV6rTbYL7crDN WysCkwFDGwOvKVYeGn1HzZtU0mUl1+t38bJZXE/2PmXN/CECsAALpVGwLt4BwlCJK/QbnZ Ukq+92JbGeLiyuiFNOk2EXvC0xtCr2U= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-587-uq9ypopcOkSRoyDePEM61A-1; Fri, 15 Sep 2023 08:15:26 -0400 X-MC-Unique: uq9ypopcOkSRoyDePEM61A-1 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-3f5df65f9f4so15413495e9.2 for ; Fri, 15 Sep 2023 05:15:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694780125; x=1695384925; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4IzPTIpBjDzBGvsyRo0gBVOG837dBZudcrNhelcBAVs=; b=TrsViEo0cxSrsQzW1qY9GTyiYzXlI0smWdUziSPvU8V3HpwVbOu4RqDhvjo0LL9F6E 5s/MK9duewX7tn9AWdzpdevce10sP/DFuscjESSCG5tgY+fbqOocrWp2ERg4m2ZlN5YN p7Iy14uoPDe3sq3V6lFn5b0rTAYxrKO9EUXsY0fLv0bdly7gBpL5B2BMrRfEJ3gysTap pIjjAA2bKDDkJDzkk7Ks4EJ46a23O/P/NkaAppp8yYol0YuTl1H1PQeID2zG0o4Glipa SfVwM70GQv/2p0Gmpa/C9l3krqqF0pB8NXbtfmoQfm58AiV8Jzsvn6kvt7OqJKmNWFMc 9wfA== X-Gm-Message-State: AOJu0YyVBJbMAMxd7rfhKr0ARjqbA21MDfEbxPXZZC+ERFlk9JFZKbLm 2uAzolly5FPi+mHCB2dcZbynACiXd7GZyNGFD1W8M9DkbQnIyw/isA7rZPLZl9NdcGxxCahkeFX bnOvg93xQx0drzKARtfLbV31x X-Received: by 2002:adf:cd08:0:b0:31f:afeb:4e71 with SMTP id w8-20020adfcd08000000b0031fafeb4e71mr1327904wrm.48.1694780124841; Fri, 15 Sep 2023 05:15:24 -0700 (PDT) X-Received: by 2002:adf:cd08:0:b0:31f:afeb:4e71 with SMTP id w8-20020adfcd08000000b0031fafeb4e71mr1327892wrm.48.1694780124604; Fri, 15 Sep 2023 05:15:24 -0700 (PDT) Received: from step1.lan ([46.222.72.72]) by smtp.gmail.com with ESMTPSA id s1-20020a5d4ec1000000b0031fbbe347e1sm4287767wrv.65.2023.09.15.05.15.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 05:15:23 -0700 (PDT) From: Stefano Garzarella To: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Stefano Garzarella , Arseniy Krasnov , virtualization@lists.linux-foundation.org, oxffffaa@gmail.com, Bobby Eshleman Subject: [PATCH net-next 5/5] vsock/test: track bytes in MSG_PEEK test for SOCK_SEQPACKET Date: Fri, 15 Sep 2023 14:14:52 +0200 Message-ID: <20230915121452.87192-6-sgarzare@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230915121452.87192-1-sgarzare@redhat.com> References: <20230915121452.87192-1-sgarzare@redhat.com> MIME-Version: 1.0 Content-type: text/plain Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Fri, 15 Sep 2023 05:16:44 -0700 (PDT) The test was a bit complicated to read. Added variables to keep track of the bytes read and to be read in each step. Also some comments. The test is unchanged. Signed-off-by: Stefano Garzarella --- tools/testing/vsock/vsock_test.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tools/testing/vsock/vsock_test.c b/tools/testing/vsock/vsock_test.c index b18acbaf92e2..5743dcae2350 100644 --- a/tools/testing/vsock/vsock_test.c +++ b/tools/testing/vsock/vsock_test.c @@ -1002,6 +1002,7 @@ static void test_stream_virtio_skb_merge_client(const struct test_opts *opts) static void test_stream_virtio_skb_merge_server(const struct test_opts *opts) { + size_t read = 0, to_read; unsigned char buf[64]; int fd; @@ -1014,14 +1015,21 @@ static void test_stream_virtio_skb_merge_server(const struct test_opts *opts) control_expectln("SEND0"); /* Read skbuff partially. */ - recv_buf(fd, buf, 2, 0, 2); + to_read = 2; + recv_buf(fd, buf + read, to_read, 0, to_read); + read += to_read; control_writeln("REPLY0"); control_expectln("SEND1"); - recv_buf(fd, buf + 2, 8, 0, 8); + /* Read the rest of both buffers */ + to_read = strlen(HELLO_STR WORLD_STR) - read; + recv_buf(fd, buf + read, to_read, 0, to_read); + read += to_read; - recv_buf(fd, buf, sizeof(buf) - 8 - 2, MSG_DONTWAIT, -EAGAIN); + /* No more bytes should be there */ + to_read = sizeof(buf) - read; + recv_buf(fd, buf + read, to_read, MSG_DONTWAIT, -EAGAIN); if (memcmp(buf, HELLO_STR WORLD_STR, strlen(HELLO_STR WORLD_STR))) { fprintf(stderr, "pattern mismatch\n"); -- 2.41.0