summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--scripts/lib/compatlayer/cases/common.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/scripts/lib/compatlayer/cases/common.py b/scripts/lib/compatlayer/cases/common.py
index ede002d50d..4c8a5439ec 100644
--- a/scripts/lib/compatlayer/cases/common.py
+++ b/scripts/lib/compatlayer/cases/common.py
@@ -1,6 +1,7 @@
1# Copyright (C) 2017 Intel Corporation 1# Copyright (C) 2017 Intel Corporation
2# Released under the MIT license (see COPYING.MIT) 2# Released under the MIT license (see COPYING.MIT)
3 3
4import glob
4import os 5import os
5import unittest 6import unittest
6from compatlayer import get_signatures, LayerType, check_command, get_depgraph 7from compatlayer import get_signatures, LayerType, check_command, get_depgraph
@@ -8,15 +9,20 @@ from compatlayer.case import OECompatLayerTestCase
8 9
9class CommonCompatLayer(OECompatLayerTestCase): 10class CommonCompatLayer(OECompatLayerTestCase):
10 def test_readme(self): 11 def test_readme(self):
11 readme_file = os.path.join(self.tc.layer['path'], 'README') 12 # The top-level README file may have a suffix (like README.rst or README.txt).
12 self.assertTrue(os.path.isfile(readme_file), 13 readme_files = glob.glob(os.path.join(self.tc.layer['path'], 'README*'))
13 msg="Layer doesn't contains README file.") 14 self.assertTrue(len(readme_files) > 0,
15 msg="Layer doesn't contains README file.")
14 16
17 # There might be more than one file matching the file pattern above
18 # (for example, README.rst and README-COPYING.rst). The one with the shortest
19 # name is considered the "main" one.
20 readme_file = sorted(readme_files)[0]
15 data = '' 21 data = ''
16 with open(readme_file, 'r') as f: 22 with open(readme_file, 'r') as f:
17 data = f.read() 23 data = f.read()
18 self.assertTrue(data, 24 self.assertTrue(data,
19 msg="Layer contains README file but is empty.") 25 msg="Layer contains a README file but it is empty.")
20 26
21 def test_parse(self): 27 def test_parse(self):
22 check_command('Layer %s failed to parse.' % self.tc.layer['name'], 28 check_command('Layer %s failed to parse.' % self.tc.layer['name'],