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