[PATCH 1/2] tests: ibss kill subprocess usage

Janusz Dziedzic janusz.dziedzic at tieto.com
Sat Apr 2 12:47:11 PDT 2016

On 2 April 2016 at 20:32, Johannes Berg <johannes at sipsolutions.net> wrote:
> On Sat, 2016-04-02 at 08:24 +0200, Janusz Dziedzic wrote:
>> -    subprocess.check_call(['iw', 'dev', dev[0].ifname, 'set',
>> 'type', 'adhoc'])
>> -    subprocess.check_call(['iw', 'dev', dev[0].ifname, 'ibss',
>> 'join',
>> -                           'ibss-test', '2412', 'HT20', 'fixed-
>> freq',
>> -                           '02:22:33:44:55:66'])
>> +    dev[0].host.execute("iw dev " + dev[0].ifname + " set type
>> adhoc")
> I suppose I should've seen that in some other patch in the previous
> series, but can we perhaps find a way to not have to do string
> manipulation here? host.execute() should probably take a list just like
> subprocess.Popen() does, and execute it as such, rather than passing it
> through a shell? And even if that's absolutely not possible (using
> ssh?) then we should probably do string quoting in a central place in
> the code.
I decide to not fix all problems in one patchset - to much changes.
First I added hwsim_wrapper() for remote test execution with current
hwsim test cases. After that I can fix test cases one by one.

Regarding host.execute(), this using subprocess.check_output( ..., shell=False)
Anyway I think this is possible to get list and build string in Host()
class for ssh case. while
for local_execute() and execute(host=None) I split command back to the list.


> johannes

More information about the Hostap mailing list