Rtos API example

Committer:
marcozecchini
Date:
Sat Feb 23 12:13:36 2019 +0000
Revision:
0:9fca2b23d0ba
final commit

Who changed what in which revision?

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