Bug 8307 - AttributeError: 'TestContext' object has no attribute 'sigterm'
Summary: AttributeError: 'TestContext' object has no attribute 'sigterm'
Status: CLOSED NOTABUG
Alias: None
Product: Runtime Testing
Classification: QA/Testing
Component: general (show other bugs)
Version: unspecified
Hardware: x86 Multiple
: Medium+ critical
Target Milestone: 2.0
Assignee: Mariano Lopez
QA Contact: Alexandru Georgescu
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2015-09-16 03:40 UTC by zjh
Modified: 2015-09-22 02:49 UTC (History)
5 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description zjh 2015-09-16 03:40:16 UTC
Traceback (most recent call last):
  File "/home/tester/Iot-auto/AFT/2015_09_16_09_50_52/galileo_sanity/iottest/oeqa/oetest.py", line 149, in setUp
    if self.tc.sigterm:
AttributeError: 'TestContext' object has no attribute 'sigterm'


Our test cases is run by an exported runner.
Maybe in setUp should judge self.tc has 'sigterm' first,
Or sync this feature to runexported.py
Comment 1 Cathy Shen 2015-09-16 06:38:08 UTC
Impact both QA and CI testing, pls. prioritize.
Comment 2 Mariano Lopez 2015-09-18 14:46:57 UTC
Adding the SIGTERM handler broke the (the already broken) exported test feature. The problem right now with exported test is that has been broken for months and is not easy to test changes against it.
Comment 3 Mariano Lopez 2015-09-18 14:48:44 UTC
zjh, cathy,

If you have a working version of runexported tests, please consider to share it in the mailing list.
Comment 4 Mariano Lopez 2015-09-18 22:00:42 UTC
Send patch to the mailing list to fix the break introduced when handling the SIGTERM signal in testimage. You can find the patch here:

http://lists.openembedded.org/pipermail/openembedded-core/2015-September/110708.html

And the commit is also in poky contrib here:

http://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/log/?h=mariano/bug8307

I've already checked and the sigterm var is handled fine when exporting the test, although running the exported test is still broken
Comment 5 zjh 2015-09-21 05:08:57 UTC

(In reply to comment #3)
> zjh, cathy,
> 
> If you have a working version of runexported tests, please consider to share
> it in the mailing list.

We didn't use the original export feature of yocto, the original feature has missed bb package(since runtest.py had imported bb).
Most of our export features are from yocto, you can try it with these steps:

ssh://zjh@10.239.52.71/home/zjh/meta-qa
passwd: 123456
1. add this layer to your poky: 
    cd [path to your poky]; git clone ssh://zjh@10.239.52.71/home/zjh/meta-qa; vi build/conf/bblayers.conf
2. add thease info to your build/conf/local.conf:
INHERIT += "test-iot"
TEST_EXPORT_DIR = "iottest"
TEST_TARGET = "simpleremote"
TEST_TARGET_IP = "192.168.7.2"
TEST_SERVER_IP = "192.168.7.1"
TEST_SUITES_MANIFEST = "[path to your poky]/meta-qa/conf/test/iottest.manifest"

3. bitbake core-image-sato, this step will build hello and hello-host
4. start your qemu
5. use another terminal to run test suite: bitbake core-image-sato -c test_iot
6. export testsuite: bitbake core-image-sato -c test_iot_export
7. run exported test suite: cd tmp/deploy/testsuite; tar xf  iot-testsuite.tar.gz; tar xf iot-testfiles.qemux86 .tar.gz -C iottest; cd iottest; python runtest.py -m qemux86 -t 192.168.7.2
Comment 6 zjh 2015-09-21 05:11:27 UTC
(In reply to comment #4)
> Send patch to the mailing list to fix the break introduced when handling the
> SIGTERM signal in testimage. You can find the patch here:
> 
> http://lists.openembedded.org/pipermail/openembedded-core/2015-September/
> 110708.html
> 
> And the commit is also in poky contrib here:
> 
> http://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/log/?h=mariano/bug8307
> 
> I've already checked and the sigterm var is handled fine when exporting the
> test, although running the exported test is still broken

If you follow my steps from my previous comment, you will find this issue is still exist after apply your patch
Comment 7 zjh 2015-09-21 05:13:14 UTC
(In reply to comment #5)
> 
> (In reply to comment #3)
> > zjh, cathy,
> > 
> > If you have a working version of runexported tests, please consider to share
> > it in the mailing list.
> 
> We didn't use the original export feature of yocto, the original feature has
> missed bb package(since runtest.py had imported bb).
> Most of our export features are from yocto, you can try it with these steps:
> 
> ssh://zjh@10.239.52.71/home/zjh/meta-qa
> passwd: 123456
> 1. add this layer to your poky: 
>     cd [path to your poky]; git clone
> ssh://zjh@10.239.52.71/home/zjh/meta-qa; vi build/conf/bblayers.conf
> 2. add thease info to your build/conf/local.conf:
> INHERIT += "test-iot"
> TEST_EXPORT_DIR = "iottest"
> TEST_TARGET = "simpleremote"
> TEST_TARGET_IP = "192.168.7.2"
> TEST_SERVER_IP = "192.168.7.1"
> TEST_SUITES_MANIFEST = "[path to your
> poky]/meta-qa/conf/test/iottest.manifest"
> 
> 3. bitbake core-image-sato, this step will build hello and hello-host
> 4. start your qemu
> 5. use another terminal to run test suite: bitbake core-image-sato -c
> test_iot
> 6. export testsuite: bitbake core-image-sato -c test_iot_export
> 7. run exported test suite: cd tmp/deploy/testsuite; tar xf 
> iot-testsuite.tar.gz; tar xf iot-testfiles.qemux86 .tar.gz -C iottest; cd
> iottest; python runtest.py -m qemux86 -t 192.168.7.2

step 5 is not necessary in this case
Comment 8 Mariano Lopez 2015-09-21 20:42:10 UTC
I was able to reproduce the problem. The issue is within meta-qa on runtest.py.

You are using runtest instead of runexported; in runtest you recreate testContext by hand (d and target) but in runexported the object data is stored in a JSON file and read from there.

Also the host_dumper object is never recreated in runtest, so if at some point a test needs it you'll have another issue.

What I would recommend is to recreate the missing objects or attributes in runtest using the exported JSON produced by testimage, otherwise if we keep adding functionality to the testimage class you would experience more errors.
Comment 9 zjh 2015-09-22 02:27:38 UTC
Yes, you are right. I have tried this in runexport.py(need add poky/bitbake/lib to sys.path first in runexport.py). Didn't find this issue.
We were trying to keep the test suite is independent before. So we removed some feature from runexport.py.
Anyway, this is not a upstream bug. Thanks for your clarification. We will change our scripts to keep sync up with upstream.
Comment 10 Cathy Shen 2015-09-22 02:49:42 UTC
Thanks, close this ticket.