BA
/
BaBoRo_test2
Backup 1
mbed-os/tools/compliance/ioper_test_fs.py@0:02dd72d1d465, 2018-04-24 (annotated)
- Committer:
- borlanic
- Date:
- Tue Apr 24 11:45:18 2018 +0000
- Revision:
- 0:02dd72d1d465
BaBoRo_test2 - backup 1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
borlanic | 0:02dd72d1d465 | 1 | """ |
borlanic | 0:02dd72d1d465 | 2 | mbed SDK |
borlanic | 0:02dd72d1d465 | 3 | Copyright (c) 2011-2015 ARM Limited |
borlanic | 0:02dd72d1d465 | 4 | |
borlanic | 0:02dd72d1d465 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); |
borlanic | 0:02dd72d1d465 | 6 | you may not use this file except in compliance with the License. |
borlanic | 0:02dd72d1d465 | 7 | You may obtain a copy of the License at |
borlanic | 0:02dd72d1d465 | 8 | |
borlanic | 0:02dd72d1d465 | 9 | http://www.apache.org/licenses/LICENSE-2.0 |
borlanic | 0:02dd72d1d465 | 10 | |
borlanic | 0:02dd72d1d465 | 11 | Unless required by applicable law or agreed to in writing, software |
borlanic | 0:02dd72d1d465 | 12 | distributed under the License is distributed on an "AS IS" BASIS, |
borlanic | 0:02dd72d1d465 | 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
borlanic | 0:02dd72d1d465 | 14 | See the License for the specific language governing permissions and |
borlanic | 0:02dd72d1d465 | 15 | limitations under the License. |
borlanic | 0:02dd72d1d465 | 16 | |
borlanic | 0:02dd72d1d465 | 17 | Author: Przemyslaw Wirkus <Przemyslaw.Wirkus@arm.com> |
borlanic | 0:02dd72d1d465 | 18 | |
borlanic | 0:02dd72d1d465 | 19 | """ |
borlanic | 0:02dd72d1d465 | 20 | |
borlanic | 0:02dd72d1d465 | 21 | import os.path |
borlanic | 0:02dd72d1d465 | 22 | from ioper_base import IOperTestCaseBase |
borlanic | 0:02dd72d1d465 | 23 | |
borlanic | 0:02dd72d1d465 | 24 | |
borlanic | 0:02dd72d1d465 | 25 | class IOperTest_FileStructure(IOperTestCaseBase): |
borlanic | 0:02dd72d1d465 | 26 | |
borlanic | 0:02dd72d1d465 | 27 | def __init__(self, scope=None): |
borlanic | 0:02dd72d1d465 | 28 | IOperTestCaseBase.__init__(self, scope) |
borlanic | 0:02dd72d1d465 | 29 | |
borlanic | 0:02dd72d1d465 | 30 | def if_file_exist(self, fname, fail_severity=None): |
borlanic | 0:02dd72d1d465 | 31 | file_path = os.path.join(self.param['mount_point'], fname) |
borlanic | 0:02dd72d1d465 | 32 | exist = os.path.isfile(file_path) |
borlanic | 0:02dd72d1d465 | 33 | tr_name = "FILE_EXIST(%s)" % fname.upper() |
borlanic | 0:02dd72d1d465 | 34 | if exist: |
borlanic | 0:02dd72d1d465 | 35 | self.result.append((self.PASS, tr_name, self.scope, "File '%s' exists" % file_path)) |
borlanic | 0:02dd72d1d465 | 36 | else: |
borlanic | 0:02dd72d1d465 | 37 | self.result.append((fail_severity if fail_severity else self.ERROR, tr_name, self.scope, "File '%s' not found" % file_path)) |
borlanic | 0:02dd72d1d465 | 38 | |
borlanic | 0:02dd72d1d465 | 39 | def test(self, param=None): |
borlanic | 0:02dd72d1d465 | 40 | self.result = [] |
borlanic | 0:02dd72d1d465 | 41 | if param: |
borlanic | 0:02dd72d1d465 | 42 | pass |
borlanic | 0:02dd72d1d465 | 43 | return self.result |
borlanic | 0:02dd72d1d465 | 44 | |
borlanic | 0:02dd72d1d465 | 45 | |
borlanic | 0:02dd72d1d465 | 46 | class IOperTest_FileStructure_Basic(IOperTest_FileStructure): |
borlanic | 0:02dd72d1d465 | 47 | def __init__(self, scope=None): |
borlanic | 0:02dd72d1d465 | 48 | IOperTest_FileStructure.__init__(self, scope) |
borlanic | 0:02dd72d1d465 | 49 | |
borlanic | 0:02dd72d1d465 | 50 | def test(self, param=None): |
borlanic | 0:02dd72d1d465 | 51 | self.param = param |
borlanic | 0:02dd72d1d465 | 52 | self.result = [] |
borlanic | 0:02dd72d1d465 | 53 | if param: |
borlanic | 0:02dd72d1d465 | 54 | self.if_file_exist('mbed.htm', self.ERROR) |
borlanic | 0:02dd72d1d465 | 55 | return self.result |
borlanic | 0:02dd72d1d465 | 56 | |
borlanic | 0:02dd72d1d465 | 57 | |
borlanic | 0:02dd72d1d465 | 58 | class IOperTest_FileStructure_MbedEnabled(IOperTest_FileStructure): |
borlanic | 0:02dd72d1d465 | 59 | def __init__(self, scope=None): |
borlanic | 0:02dd72d1d465 | 60 | IOperTest_FileStructure.__init__(self, scope) |
borlanic | 0:02dd72d1d465 | 61 | |
borlanic | 0:02dd72d1d465 | 62 | def test(self, param=None): |
borlanic | 0:02dd72d1d465 | 63 | self.param = param |
borlanic | 0:02dd72d1d465 | 64 | self.result = [] |
borlanic | 0:02dd72d1d465 | 65 | if param: |
borlanic | 0:02dd72d1d465 | 66 | self.if_file_exist('mbed.htm', self.ERROR) |
borlanic | 0:02dd72d1d465 | 67 | self.if_file_exist('DETAILS.TXT', self.ERROR) |
borlanic | 0:02dd72d1d465 | 68 | self.if_file_exist('FAIL.TXT', self.INFO) |
borlanic | 0:02dd72d1d465 | 69 | return self.result |