From patchwork Thu Jan 23 20:25:24 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Berg X-Patchwork-Id: 313718 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from maxx.maxx.shmoo.com (maxx.shmoo.com [205.134.188.171]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 2975E2C009B for ; Fri, 24 Jan 2014 07:25:42 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 69AAA9D378; Thu, 23 Jan 2014 15:25:40 -0500 (EST) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HfriJsqttCLX; Thu, 23 Jan 2014 15:25:40 -0500 (EST) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 2D5599D36C; Thu, 23 Jan 2014 15:25:36 -0500 (EST) X-Original-To: mailman-post+hostap@maxx.shmoo.com Delivered-To: mailman-post+hostap@maxx.shmoo.com Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 3C4BA9D36C for ; Thu, 23 Jan 2014 15:25:34 -0500 (EST) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XRH8RXKm1AF3 for ; Thu, 23 Jan 2014 15:25:30 -0500 (EST) Received: from sipsolutions.net (s3.sipsolutions.net [144.76.43.152]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (Client did not present a certificate) by maxx.maxx.shmoo.com (Postfix) with ESMTPS id 05E9C9D36B for ; Thu, 23 Jan 2014 15:25:29 -0500 (EST) Received: by sipsolutions.net with esmtpsa (TLS1.1:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1W6Qq7-0003f3-V7; Thu, 23 Jan 2014 21:25:28 +0100 From: Johannes Berg To: hostap@lists.shmoo.com Subject: [PATCH] hwsim tests: convert radio work test to new notation Date: Thu, 23 Jan 2014 21:25:24 +0100 Message-Id: <1390508724-21571-1-git-send-email-johannes@sipsolutions.net> X-Mailer: git-send-email 1.8.5.2 Cc: Johannes Berg X-BeenThere: hostap@lists.shmoo.com X-Mailman-Version: 2.1.11 Precedence: list List-Id: HostAP Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@lists.shmoo.com From: Johannes Berg Convert the radio work test to the new notation that the previous "python magic" patch made possible. This is mostly intended as an example. We can convert more if you want, but there's a tradeoff between the 'nice' python syntax and the 'raw' control interface strings. It was just an idea I had. Signed-hostap: Johannes Berg --- tests/hwsim/test_radio_work.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/hwsim/test_radio_work.py b/tests/hwsim/test_radio_work.py index 7f4f5c7..9baccee 100644 --- a/tests/hwsim/test_radio_work.py +++ b/tests/hwsim/test_radio_work.py @@ -15,13 +15,13 @@ import hostapd def test_ext_radio_work(dev, apdev): """External radio work item""" - id = dev[0].request("RADIO_WORK add test-work-a") + id = dev[0].radio_work.add("test-work-a") if "FAIL" in id: raise Exception("Failed to add radio work") - id2 = dev[0].request("RADIO_WORK add test-work-b freq=2417") + id2 = dev[0].radio_work.add("test-work-b", freq=2417) if "FAIL" in id2: raise Exception("Failed to add radio work") - id3 = dev[0].request("RADIO_WORK add test-work-c") + id3 = dev[0].radio_work.add("test-work-c") if "FAIL" in id3: raise Exception("Failed to add radio work") @@ -31,7 +31,7 @@ def test_ext_radio_work(dev, apdev): if "EXT-RADIO-WORK-START " + id not in ev: raise Exception("Unexpected radio work start id") - items = dev[0].request("RADIO_WORK show") + items = dev[0].radio_work.show() if "ext:test-work-a@wlan0:0:1:" not in items: logger.info("Pending radio work items:\n" + items) raise Exception("Radio work item(a) missing from the list") @@ -42,16 +42,16 @@ def test_ext_radio_work(dev, apdev): logger.info("Pending radio work items:\n" + items) raise Exception("Radio work item(c) missing from the list") - dev[0].request("RADIO_WORK done " + id2) - dev[0].request("RADIO_WORK done " + id) + dev[0].radio_work.done(id2) + dev[0].radio_work.done(id) ev = dev[0].wait_event(["EXT-RADIO-WORK-START"]) if ev is None: raise Exception("Timeout while waiting radio work to start") if "EXT-RADIO-WORK-START " + id3 not in ev: raise Exception("Unexpected radio work start id") - dev[0].request("RADIO_WORK done " + id3) - items = dev[0].request("RADIO_WORK show") + dev[0].radio_work.done(id3) + items = dev[0].radio_work.show() if "ext:" in items: logger.info("Pending radio work items:\n" + items) raise Exception("Unexpected remaining radio work item")