Received: by 2002:a05:7208:3003:b0:81:def:69cd with SMTP id f3csp4208459rba; Tue, 2 Apr 2024 10:11:42 -0700 (PDT) X-Forwarded-Encrypted: i=4; AJvYcCWOZgECI4CMQVE3unEsYmOUMiNEkIbfyP5Ti3GpLZTTtjjMZHy1m2aHdHKJ1LO60Hk21dOFBaCpEtErdOuBnZygd5GriBO2OF5wYMk4DQ== X-Google-Smtp-Source: AGHT+IEqf2aB+ua7cIVTtYjUORKTSeAwlW8PcZhlQLrWP87ZgqQ1FIhj7yruDt8DLJBaJF6ajEoj X-Received: by 2002:a05:6a21:3a83:b0:1a6:fe4e:4447 with SMTP id zv3-20020a056a213a8300b001a6fe4e4447mr10874113pzb.17.1712077902640; Tue, 02 Apr 2024 10:11:42 -0700 (PDT) ARC-Seal: i=3; a=rsa-sha256; t=1712077902; cv=pass; d=google.com; s=arc-20160816; b=redYhMS4iwowhW2JlZeFlvUf3LQQVlxaBzZAJdYVOVySQu9B/niF703gEVcC3RGOHl ORLycDjv5gpVk80xbXba48b9aY8ANiBDNFFH97PX2WzyIdQDHFS+g+MWeh0lZ/eSEw5t uVYdmqKCKamuceeYYteM/Yd5TczR4PmfwDW2n9Raqfp6WwVR++W9xkZ8YqNMEepBPupE oEzQGmz+1m0wjnvdsgM84guK/ewVKBLeeKkpgNPGlg+zhjNSDlaymAUGt0uCmJ8gLuhL ElC5mViDS4nbdPaTizg4PF8mFyv1gJRBsJHy8WAWvj8TnS1exh+rBGNYmrymHwMktHSf ERVg== ARC-Message-Signature: i=3; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=LrP4Nncol27MzA8D+MQJQLCx3rKITNmukLoTjk6w3oE=; fh=ExGhjNQEFJgRqHmYATVc5UXZbS7abAmaHDitrfHKOuE=; b=kIOnI80o4r/M1WBokOuqwdekxyAG+TeXB7jDrAxQlc1OSBkNsT3QjnW7/zsYpG3ODM yEbE6xOTNQdsnZdpY1njL1ACZY+LqSbvuEVW8BHD3zI/g+JhKH50+JXQCHdzVJlgf+Pe I8mX0h9kD/LR/pQtuL6APvrdDw6pkl5JT845V0P4SsyBRl/fhxxGt49BEdJK1ExXjuI6 ua9yz0KDg+KFyq0ovI2ZyXd3vShaC73/gchiemZiy88G0y3XMEFwauGaRiQYd2VR4rAU bvB5e341IKyREc0sr/Jic4niQ1kgiSn0Nug4LlMWi1a4ZxmDpXo7tW8t5+3yc8jNa6PX qnSw==; dara=google.com ARC-Authentication-Results: i=3; mx.google.com; dkim=pass header.i=@iki.fi header.s=meesny header.b="xQkdP/rB"; arc=pass (i=2 spf=pass spfdomain=iki.fi dkim=pass dkdomain=iki.fi); spf=pass (google.com: domain of linux-bluetooth+bounces-3094-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-3094-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id y28-20020a056a00181c00b006ead015f850si11929742pfa.291.2024.04.02.10.11.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 10:11:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-3094-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@iki.fi header.s=meesny header.b="xQkdP/rB"; arc=pass (i=2 spf=pass spfdomain=iki.fi dkim=pass dkdomain=iki.fi); spf=pass (google.com: domain of linux-bluetooth+bounces-3094-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-3094-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id D6A6AB231C2 for ; Tue, 2 Apr 2024 16:43:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4C7B715991F; Tue, 2 Apr 2024 16:43:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=iki.fi header.i=@iki.fi header.b="xQkdP/rB" X-Original-To: linux-bluetooth@vger.kernel.org Received: from meesny.iki.fi (meesny.iki.fi [195.140.195.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2D73A15A482 for ; Tue, 2 Apr 2024 16:43:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=195.140.195.201 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712076199; cv=pass; b=VXsj4GKHI1YKC8JiYkjol4pxzrLhl8p8Pe+JQL17HBzbAbjZ07x3+rZWmAcs/fuZfvk4lhCwJezOFR56vdrRp2S5L3msuxGAJzZmNRR3mRu8XG9F1dPPKO84mWwqncVdKM4MjLmgWasE6NdzqA1wgNWGBRpdrf8GXkSFlrnGk9I= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712076199; c=relaxed/simple; bh=TCLET5blhARH0Y9rYNPn+iH8jknXfTvFaUVSR0DWYpo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FuUuBtsf50B8h35JF2PvvFF0p8luZ9x9j/t+5yU9r5i+ojUUrfrXJfpHyqGi7cJ+r0g7BZr4Ni8VNZ0LnYwG8nGKG2TYSTLpYaKQ+CLZ8PYs7oJgdYDj6NhTxkStFWrRmzhQbhb3iGY9vR8JphvDKz2TjRyB0LMXyBNmqQXCto4= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=iki.fi; spf=pass smtp.mailfrom=iki.fi; dkim=pass (1024-bit key) header.d=iki.fi header.i=@iki.fi header.b=xQkdP/rB; arc=pass smtp.client-ip=195.140.195.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=iki.fi Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=iki.fi Received: from monolith.lan (unknown [193.138.7.178]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: pav) by meesny.iki.fi (Postfix) with ESMTPSA id 4V8DGC5zvpzyTX; Tue, 2 Apr 2024 19:43:15 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=meesny; t=1712076196; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LrP4Nncol27MzA8D+MQJQLCx3rKITNmukLoTjk6w3oE=; b=xQkdP/rBiU8P1NIqdLwbQ24wpvPRnUKWy7cOeprGX9bEq91qyH8ry6RtaiDDzczRQqCV4N m2bhxYTjQ+e68AEh8cOBXDiCSd6+XF4T1HAQdhGsjLwJNf/dqKMelod3W00u4P0XB7jqMO Zcw018PAH/g3e38qs+x5W2+T5LEMm18= ARC-Seal: i=1; s=meesny; d=iki.fi; t=1712076196; a=rsa-sha256; cv=none; b=RlJwtOhpI7IIKnSKtV0/wYLcnkMoTtkkBwdBImIqUAi17MpHX/wbvwk0z9NmESIBFXCYxg AHX6hKSE74e7llnrWP4V2Hddq8qh6Qmp+xcKInKdzu/HPdb2mX0p5XNnah4mJ/t2J8l/S0 7P7HRIk0mMmICFeHauwlkodABwUx4Kg= ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=pav smtp.mailfrom=pav@iki.fi ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=meesny; t=1712076196; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LrP4Nncol27MzA8D+MQJQLCx3rKITNmukLoTjk6w3oE=; b=Ox7LyKMFVbxF94eDZt2gHrCwDSbMRyfY1bbHwEY59fszFUTq+NknsE+cgFMilBEkMSA6oF 293mGJSbhvscESpkq2bptYjP2+OqghYYOWtbNs9UhspHif48V7ewhifUOHfckm3e3xWq94 RKrC6rcJbg2Bv4QO0eItI50bL74yaxE= From: Pauli Virtanen To: linux-bluetooth@vger.kernel.org Cc: Pauli Virtanen Subject: [PATCH BlueZ v3 7/8] l2cap-tester: add tests for LE Client read/write/tx-timestamping Date: Tue, 2 Apr 2024 19:43:04 +0300 Message-ID: <7d439f0ec2b8f451c66b33ef720e0657c64cf21c.1712076170.git.pav@iki.fi> X-Mailer: git-send-email 2.44.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Add tests: L2CAP LE Client - Read Success L2CAP LE Client - Write Success L2CAP LE Client - TX Timestamping --- tools/l2cap-tester.c | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/tools/l2cap-tester.c b/tools/l2cap-tester.c index f990110d9..d7f2e481a 100644 --- a/tools/l2cap-tester.c +++ b/tools/l2cap-tester.c @@ -484,6 +484,30 @@ static const struct l2cap_data le_client_connect_timeout_test_1 = { .timeout = 1, }; +static const struct l2cap_data le_client_connect_read_success_test = { + .client_psm = 0x0080, + .server_psm = 0x0080, + .read_data = l2_data, + .data_len = sizeof(l2_data), +}; + +static const struct l2cap_data le_client_connect_write_success_test = { + .client_psm = 0x0080, + .server_psm = 0x0080, + .write_data = l2_data, + .data_len = sizeof(l2_data), +}; + +static const struct l2cap_data le_client_connect_tx_timestamping_test = { + .client_psm = 0x0080, + .server_psm = 0x0080, + .write_data = l2_data, + .data_len = sizeof(l2_data), + .so_timestamping = (SOF_TIMESTAMPING_SOFTWARE | + SOF_TIMESTAMPING_OPT_ID | + SOF_TIMESTAMPING_TX_SOFTWARE), +}; + static const struct l2cap_data le_client_connect_adv_success_test_1 = { .client_psm = 0x0080, .server_psm = 0x0080, @@ -1079,6 +1103,8 @@ static gboolean client_received_data(GIOChannel *io, GIOCondition cond, char buf[1024]; int sk; + tester_debug("Client received data"); + sk = g_io_channel_unix_get_fd(io); if (read(sk, buf, l2data->data_len) != l2data->data_len) { tester_warn("Unable to read %u bytes", l2data->data_len); @@ -1123,6 +1149,8 @@ static void bthost_received_data(const void *buf, uint16_t len, struct test_data *data = tester_get_data(); const struct l2cap_data *l2data = data->test_data; + tester_debug("BTHost received data: %u bytes", len); + --data->step; if (len != l2data->data_len) { @@ -1313,7 +1341,7 @@ static gboolean l2cap_connect_cb(GIOChannel *io, GIOCondition cond, goto failed; } - tester_print("Successfully connected"); + tester_print("Successfully connected to CID 0x%04x", data->dcid); if (!check_mtu(data, sk)) { tester_test_failed(); @@ -1505,6 +1533,8 @@ static void client_l2cap_connect_cb(uint16_t handle, uint16_t cid, { struct test_data *data = user_data; + tester_debug("Client connect CID 0x%04x handle 0x%04x", cid, handle); + data->dcid = cid; data->handle = handle; } @@ -2430,6 +2460,15 @@ int main(int argc, char *argv[]) test_l2cap_le("L2CAP LE Client - Timeout", &le_client_connect_timeout_test_1, setup_powered_client, test_connect_timeout); + test_l2cap_le("L2CAP LE Client - Read Success", + &le_client_connect_read_success_test, + setup_powered_client, test_connect); + test_l2cap_le("L2CAP LE Client - Write Success", + &le_client_connect_write_success_test, + setup_powered_client, test_connect); + test_l2cap_le("L2CAP LE Client - TX Timestamping", + &le_client_connect_tx_timestamping_test, + setup_powered_client, test_connect); test_l2cap_le("L2CAP LE Client, Direct Advertising - Success", &le_client_connect_adv_success_test_1, setup_powered_client, test_connect); -- 2.44.0