Update buildroot 2020.02.01 (#622)
* Update buildroot 2020.02.01 Signed-off-by: Pascal Vizeli <pvizeli@syshack.ch> * Fix LN * Fix wpa Signed-off-by: Pascal Vizeli <pvizeli@syshack.ch> * Fix lint Signed-off-by: Pascal Vizeli <pvizeli@syshack.ch> * fix-network Signed-off-by: Pascal Vizeli <pvizeli@syshack.ch> * Fix script Signed-off-by: Pascal Vizeli <pvizeli@syshack.ch>
This commit is contained in:
@@ -4,6 +4,7 @@ import re
|
||||
import glob
|
||||
import subprocess
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
#
|
||||
# Patch parsing functions
|
||||
@@ -78,6 +79,36 @@ def analyze_patches(patches):
|
||||
return (allfiles, allinfras)
|
||||
|
||||
|
||||
#
|
||||
# Unit-test parsing functions
|
||||
#
|
||||
|
||||
def get_all_test_cases(suite):
|
||||
"""Generate all test-cases from a given test-suite.
|
||||
:return: (test.module, test.name)"""
|
||||
if issubclass(type(suite), unittest.TestSuite):
|
||||
for test in suite:
|
||||
for res in get_all_test_cases(test):
|
||||
yield res
|
||||
else:
|
||||
yield (suite.__module__, suite.__class__.__name__)
|
||||
|
||||
|
||||
def list_unittests(path):
|
||||
"""Use the unittest module to retreive all test cases from a given
|
||||
directory"""
|
||||
loader = unittest.TestLoader()
|
||||
suite = loader.discover(path)
|
||||
tests = {}
|
||||
for module, test in get_all_test_cases(suite):
|
||||
module_path = os.path.join(path, *module.split('.'))
|
||||
tests.setdefault(module_path, []).append('%s.%s' % (module, test))
|
||||
return tests
|
||||
|
||||
|
||||
unittests = {}
|
||||
|
||||
|
||||
#
|
||||
# DEVELOPERS file parsing functions
|
||||
#
|
||||
@@ -89,6 +120,8 @@ class Developer:
|
||||
self.packages = parse_developer_packages(files)
|
||||
self.architectures = parse_developer_architectures(files)
|
||||
self.infras = parse_developer_infras(files)
|
||||
self.runtime_tests = parse_developer_runtime_tests(files)
|
||||
self.defconfigs = parse_developer_defconfigs(files)
|
||||
|
||||
def hasfile(self, f):
|
||||
f = os.path.abspath(f)
|
||||
@@ -97,6 +130,26 @@ class Developer:
|
||||
return True
|
||||
return False
|
||||
|
||||
def __repr__(self):
|
||||
name = '\'' + self.name.split(' <')[0][:20] + '\''
|
||||
things = []
|
||||
if len(self.files):
|
||||
things.append('{} files'.format(len(self.files)))
|
||||
if len(self.packages):
|
||||
things.append('{} pkgs'.format(len(self.packages)))
|
||||
if len(self.architectures):
|
||||
things.append('{} archs'.format(len(self.architectures)))
|
||||
if len(self.infras):
|
||||
things.append('{} infras'.format(len(self.infras)))
|
||||
if len(self.runtime_tests):
|
||||
things.append('{} tests'.format(len(self.runtime_tests)))
|
||||
if len(self.defconfigs):
|
||||
things.append('{} defconfigs'.format(len(self.defconfigs)))
|
||||
if things:
|
||||
return 'Developer <{} ({})>'.format(name, ', '.join(things))
|
||||
else:
|
||||
return 'Developer <' + name + '>'
|
||||
|
||||
|
||||
def parse_developer_packages(fnames):
|
||||
"""Given a list of file patterns, travel through the Buildroot source
|
||||
@@ -154,12 +207,43 @@ def parse_developer_infras(fnames):
|
||||
return infras
|
||||
|
||||
|
||||
def parse_developer_defconfigs(fnames):
|
||||
"""Given a list of file names, returns the config names
|
||||
corresponding to defconfigs."""
|
||||
return {os.path.basename(fname[:-10])
|
||||
for fname in fnames
|
||||
if fname.endswith('_defconfig')}
|
||||
|
||||
|
||||
def parse_developer_runtime_tests(fnames):
|
||||
"""Given a list of file names, returns the runtime tests
|
||||
corresponding to the file."""
|
||||
all_files = []
|
||||
# List all files recursively
|
||||
for fname in fnames:
|
||||
if os.path.isdir(fname):
|
||||
for root, _dirs, files in os.walk(fname):
|
||||
all_files += [os.path.join(root, f) for f in files]
|
||||
else:
|
||||
all_files.append(fname)
|
||||
|
||||
# Get all runtime tests
|
||||
runtimes = set()
|
||||
for f in all_files:
|
||||
name = os.path.splitext(f)[0]
|
||||
if name in unittests:
|
||||
runtimes |= set(unittests[name])
|
||||
return runtimes
|
||||
|
||||
|
||||
def parse_developers(basepath=None):
|
||||
"""Parse the DEVELOPERS file and return a list of Developer objects."""
|
||||
developers = []
|
||||
linen = 0
|
||||
if basepath is None:
|
||||
basepath = os.getcwd()
|
||||
global unittests
|
||||
unittests = list_unittests(os.path.join(basepath, 'support/testing'))
|
||||
with open(os.path.join(basepath, "DEVELOPERS"), "r") as f:
|
||||
files = []
|
||||
name = None
|
||||
|
||||
Reference in New Issue
Block a user