qca / boardfarm

Main repo moved to:
https://github.com/mattsm/boardfarm/
BSD 3-Clause Clear License
70 stars 54 forks source link

Test "KernelModules" failed #66

Closed yi-liang closed 7 years ago

yi-liang commented 7 years ago

It seems the test "KernelModules" failed because in boardfarm/tests/lsmod.py, line 14-16 board.sendline('\nlsmod | wc -l') board.expect('lsmod ') board.expect('(\d+)\r\n') looks like it was verifying the response from "lsmod | wc -l" but the returned string would be a number without "/r/n"? If changed to board.expect('(\d+)') then the test can pass

mattsm commented 7 years ago

Can you share a log?

mbanders commented 7 years ago

Is it possible the output is slightly different depending on if a user connects via serial console port vs ethernet port? Or maybe different versions of commands?

On my router:

$ ssh root@192.168.1.1 'lsmod | wc -l' > test.txt
$ cat -A test.txt 
102$

That last $ I think means just the \n character. If there was a \r it would display as ^M?

yi-liang commented 7 years ago

Sure, the log: ==================== Begin KernelModules ====================

root@OpenWrt:/# root@OpenWrt:/# | wcroot@OpenWrt:/# -lroot@OpenWrt:/# lsmod | wc -l 108 root@OpenWrt:/# root@OpenWrt:/#

TEST_CASE_RESULT = FAIL

=========== Test failed! Running recovery =========== File "/home/jenkins/boardfarm/boardfarm/tests/linux_boot.py", line 72, in testWrapper self.runTest() File "/home/jenkins/boardfarm/boardfarm/tests/lsmod.py", line 16, in runTest board.expect('(\d+)\r\n') File "/home/jenkins/boardfarm/boardfarm/devices/openwrt_router.py", line 436, in expect return super(OpenWrtRouter, self).expect(_args, *_kwargs)

| wc -l 108 root@OpenWrt:/# root@OpenWrt:/#

yi-liang commented 7 years ago

thanks, @mbanders , in my case it was connecting via serial port, not sure about the command version, seems there is also a "$" at the end

$ ssh root@192.168.0.2 'lsmod | wc -l' > test.txt
$ cat  -A test.txt
108$
mbanders commented 7 years ago

I made it safer and fewer lines of code, please review it: https://github.com/qca/boardfarm/pull/67