]> code.ossystems Code Review - openembedded-core.git/commit
buildstats-diff: show more graceful error messages
authorMing Liu <peter.x.liu@external.atlascopco.com>
Tue, 6 Jun 2017 03:19:43 +0000 (05:19 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 9 Jun 2017 16:12:04 +0000 (17:12 +0100)
commitdee3c29071017b4d12c02b711c5e42ca96e0578d
treef167ec3ce27f6ca9ce27e97172e5aba5b9dea983
parent0addd079966ece97abc2e0ba3e7d6434d23692aa
buildstats-diff: show more graceful error messages

I got a following error when I run buildstats-diff against a invalid
buildstats file:
| Traceback (most recent call last):
|   File "/poky/scripts/buildstats-diff", line 548, in <module>
|     sys.exit(main())
|   File "/poky/scripts/buildstats-diff", line 534, in main
|     bs1 = read_buildstats(args.buildstats1, args.multi)
|   File "/poky/scripts/buildstats-diff", line 222, in read_buildstats
|     return read_buildstats_dir(path)
|   File "/poky/scripts/buildstats-diff", line 165, in read_buildstats_dir
|     os.path.join(recipe_dir, task))]
|   File "/poky/scripts/buildstats-diff", line 124, in read_buildstats_file
|     bs_task['elapsed_time'] = end_time - start_time
| UnboundLocalError: local variable 'end_time' referenced before assignment

the root cause is that a task was terminated by me on the terminal,
so the generated buildstats file was invalid, supposing that it would
make the buildstats.sh fail, but the script should give more graceful
error messages.

Signed-off-by: Ming Liu <peter.x.liu@external.atlascopco.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
scripts/buildstats-diff