Rename deviceinfo variable flash_methods to flash_method (#1030)

* Rename deviceinfo variable flash_methods to flash_method
* Update pmb.config.deviceinfo_attributes / add sanity check
* Add test case that parses all deviceinfo files
This commit is contained in:
Attila Szöllősi 2017-12-21 23:12:52 +01:00 committed by Oliver Smith
parent d34e8d172e
commit c6eb56c200
91 changed files with 188 additions and 132 deletions

View file

@ -125,7 +125,7 @@ def test_aportgen_device_wizard(args, monkeypatch):
assert deviceinfo["arch"] == "armhf"
assert deviceinfo["keyboard"] == "false"
assert deviceinfo["external_disk"] == "true"
assert deviceinfo["flash_methods"] == "heimdall-isorec"
assert deviceinfo["flash_method"] == "heimdall-isorec"
assert deviceinfo["generate_bootimg"] == ""
assert deviceinfo["generate_legacy_uboot_initfs"] == ""
@ -147,7 +147,7 @@ def test_aportgen_device_wizard(args, monkeypatch):
answers["Path"] = ""
deviceinfo, apkbuild, apkbuild_linux = generate(args, monkeypatch, answers)
assert apkbuild["depends"] == ["linux-testsuite-testdevice", "mkbootimg"]
assert deviceinfo["flash_methods"] == answers["Flash method"]
assert deviceinfo["flash_method"] == answers["Flash method"]
assert deviceinfo["generate_bootimg"] == "true"
# 0xffff (legacy uboot initfs)

View file

@ -0,0 +1,50 @@
"""
Copyright 2017 Oliver Smith
This file is part of pmbootstrap.
pmbootstrap is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
pmbootstrap is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with pmbootstrap. If not, see <http://www.gnu.org/licenses/>.
"""
import os
import sys
import glob
import pytest
# Import from parent directory
pmb_src = os.path.realpath(os.path.join(os.path.dirname(__file__) + "/.."))
sys.path.append(pmb_src)
import pmb.parse.apkindex
import pmb.parse.apkbuild
import pmb.helpers.logging
@pytest.fixture
def args(request):
import pmb.parse
sys.argv = ["pmbootstrap.py", "chroot"]
args = pmb.parse.arguments()
args.log = args.work + "/log_testsuite.txt"
pmb.helpers.logging.init(args)
request.addfinalizer(args.logfd.close)
return args
def test_deviceinfo(args):
"""
Parse all deviceinfo files. When no exception gets raised, we're good.
"""
for folder in glob.glob(args.aports + "/device/device-*"):
device = folder.split("-", 1)[1]
print(device)
pmb.parse.deviceinfo(args, device)