Message ID | 20190131081617.5005-1-masashi.honma@gmail.com |
---|---|
Headers | show |
Series | Use python3 compatible codes for hwsim tests | expand |
On Thu, Jan 31, 2019 at 05:15:39PM +0900, Masashi Honma wrote: > This patch set modifies hwsim test to support python3 because python2 is > deprecated from 2020. After applying this patch set, user can run hwsim > test both python2 and python3. We can run with python3 by modifying > run-tests.py. Thanks, applied with number of fixes and cleanup. I ended up splitting the patches differently to make it easier to review the changes and to be able to pick the parts that looked correct to me. I did replace some areas by not doing unnecessary hexlify/unhexlify conversions (i.e., using binary comparisons where appropriate and hex strings were more convenient). In addition, I did more changes with wpaspy support. > [failing tests] > Some test cases fails. This is not because of python3, it fails with python2 > also. This is the list of the test cases. In addition to this, it looks like number of test cases were being skipped in your setup. Those test cases missed changes needed for python3. I implemented those and the end result can now pass every single test case with both python2 and python3. While the coverage looks more or less identical, there are some differences in particular due to the way dict iteration works. python3 ended up processing the dict entries in different order and that ended up actually finding a real bug in the D-Bus handling.. I did not yet check whether there could be other differences in coverage, so I left the python2 as the default for now. Anyway, the goal from now on would be to maintain working python3 support and likely remove that python2 default eventually. > [known issue] > Writing un-printable code with logger.debug() causes exception. > This occurs only at vm environment and this does not interrupt the test. > The test end with PASS even thought this exception. > > Traceback (most recent call last): > File "/usr/lib/python3.6/logging/__init__.py", line 996, in emit > stream.write(msg) > UnicodeEncodeError: 'ascii' codec can't encode character '\x80' in position 68: ordinal not in range(128) It looks like the logging.FileHandler() is not able to handle these and at least with Python 3.5.2 it did not even handle utf-8 which was a bit surprising. I tried to get that working, but did not find any easy way of doing so. Should try to figure out what exactly is happening here and why utf-8 part did not work.. For non-printable-even-with-utf-8-working cases, those should probably be filtered out by the code that generates such output. It does not really belong in a log file that is supposed to be text.
On 2019/02/05 10:21, Jouni Malinen wrote: > Thanks, applied with number of fixes and cleanup. I ended up splitting > the patches differently to make it easier to review the changes and to > be able to pick the parts that looked correct to me. I did replace some > areas by not doing unnecessary hexlify/unhexlify conversions (i.e., > using binary comparisons where appropriate and hex strings were more > convenient). In addition, I did more changes with wpaspy support. Thank you so much and sorry so much ! I will take care to write more precise commit log and not to send many patches at on time to reduce your review and clean up efforts. >> [failing tests] >> Some test cases fails. This is not because of python3, it fails with python2 >> also. This is the list of the test cases. > > In addition to this, it looks like number of test cases were being > skipped in your setup. Those test cases missed changes needed for > python3. I implemented those and the end result can now pass every > single test case with both python2 and python3. > > While the coverage looks more or less identical, there are some > differences in particular due to the way dict iteration works. python3 > ended up processing the dict entries in different order and that ended > up actually finding a real bug in the D-Bus handling.. I did not yet > check whether there could be other differences in coverage, so I left > the python2 as the default for now. Anyway, the goal from now on would > be to maintain working python3 support and likely remove that python2 > default eventually. Yes. I have a list of skipped test cases. 225 test cases are skipped even though I am using latest hostapd/wpa_supplicant and wireless-testing and vm/kernel-config. I must study more about this. >> [known issue] >> Writing un-printable code with logger.debug() causes exception. >> This occurs only at vm environment and this does not interrupt the test. >> The test end with PASS even thought this exception. >> >> Traceback (most recent call last): >> File "/usr/lib/python3.6/logging/__init__.py", line 996, in emit >> stream.write(msg) >> UnicodeEncodeError: 'ascii' codec can't encode character '\x80' in position 68: ordinal not in range(128) > > It looks like the logging.FileHandler() is not able to handle these and > at least with Python 3.5.2 it did not even handle utf-8 which was a bit > surprising. I tried to get that working, but did not find any easy way > of doing so. Should try to figure out what exactly is happening here and > why utf-8 part did not work.. For non-printable-even-with-utf-8-working > cases, those should probably be filtered out by the code that generates > such output. It does not really belong in a log file that is supposed to > be text. Thank you and sorry for incomplete patch set. Masashi Honma.