Skip to content

Commit

Permalink
Merge pull request #10326 from ARMmbed/release-candidate
Browse files Browse the repository at this point in the history
Release candidate for mbed-os-5.12.1
  • Loading branch information
0xc0170 authored Apr 8, 2019
2 parents 6bf7fd3 + 869028c commit 0063e5d
Show file tree
Hide file tree
Showing 595 changed files with 330,580 additions and 117,654 deletions.
59 changes: 29 additions & 30 deletions .astyleignore
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
BUILD
cmsis
features/cryptocell
features/mbedtls
features/lwipstack/lwip
features/lwipstack/lwip-sys
rtos/TARGET_CORTEX/rtx4
features/storage/filesystem/littlefs/littlefs/
features/storage/filesystem/fat/ChaN
features/storage/FEATURE_STORAGE
features/frameworks
features/FEATURE_BLE
features/unsupported/
features/netsocket/emac-drivers
hal/storage_abstraction
TESTS/mbed_hal/trng/pithy
features/nanostack/coap-service
features/nanostack/sal-stack-nanostack
features/nanostack/targets
rtos/TARGET_CORTEX/rtx5
TESTS/mbed_hal/trng/pithy
targets
components/802.15.4_RF
components/wifi
components/TARGET_PSA/TARGET_TFM
tools
components/TARGET_PSA/TESTS
components/TARGET_PSA/services/attestation/COMPONENT_PSA_SRV_IMPL/tfm_impl
components/TARGET_PSA/services/attestation/qcbor
components/TARGET_PSA/services/attestation/attestation.h
^BUILD
^cmsis
^components/802.15.4_RF
^components/TARGET_PSA/services/attestation/attestation.h
^components/TARGET_PSA/services/attestation/COMPONENT_PSA_SRV_IMPL/tfm_impl
^components/TARGET_PSA/services/attestation/qcbor
^components/TARGET_PSA/TARGET_TFM
^components/TARGET_PSA/TESTS
^features/cryptocell
^features/FEATURE_BLE
^features/frameworks
^features/lwipstack/lwip
^features/lwipstack/lwip-sys
^features/mbedtls
^features/nanostack/coap-service
^features/nanostack/sal-stack-nanostack
^features/nanostack/targets
^features/netsocket/emac-drivers
^features/storage/FEATURE_STORAGE
^features/storage/filesystem/fat/ChaN
^features/storage/filesystem/littlefs/littlefs/
^features/unsupported/
^hal/storage_abstraction
^rtos/TARGET_CORTEX/rtx4
^rtos/TARGET_CORTEX/rtx5
^targets
^TESTS/mbed_hal/trng/pithy
^TESTS/mbed_hal/trng/pithy
^tools
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ matrix:
- NAME=astyle
install:
- >-
curl -L0 https://mbed-os.s3-eu-west-1.amazonaws.com/builds/deps/astyle_3.1_linux.tar.gz --output astyle.tar.gz;
curl -L0 https://mbed-os-ci.s3-eu-west-1.amazonaws.com/jenkins-ci/deps/astyle_3.1_linux.tar.gz --output astyle.tar.gz;
mkdir -p BUILD && tar xf astyle.tar.gz -C BUILD;
cd BUILD/astyle/build/gcc;
make;
Expand All @@ -183,7 +183,7 @@ matrix:
- >-
git diff --name-only --diff-filter=d FETCH_HEAD..HEAD \
| ( grep '.\(c\|cpp\|h\|hpp\)$' || true ) \
| ( fgrep -v -f .astyleignore || true ) \
| ( grep -v -f .astyleignore || true ) \
| while read file; do astyle -n --options=.astylerc "${file}"; done
- git diff --exit-code --diff-filter=d --color

Expand Down
28 changes: 28 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,31 @@ Folders containing files under different permissive license than Apache 2.0 are
- [TESTS/mbed_hal/trng/pithy](./TESTS/mbed_hal/trng/pithy) - BSD-3-Clause
- [tools/data/rpc](./tools/data/rpc) - MIT
- [targets](./targets) - PBL, BSD-style, MIT-style, Zlib-style, Public-domain

The Python modules used by Mbed tools are used under the following licenses:

- [colorama](https://pypi.org/project/colorama) - BSD-3-Clause
- [urllib3](https://pypi.org/project/urllib3) - MIT
- [secure](https://pypi.org/project/secure) - MIT
- [prettytable](https://pypi.org/project/prettytable) - BSD-3-Clause
- [junit-xml](https://pypi.org/project/junit-xml) - MIT
- [pyyaml](https://pypi.org/project/pyyaml) - MIT
- [jsonschema](https://pypi.org/project/jsonschema) - MIT
- [future](https://pypi.org/project/future) - MIT
- [six](https://pypi.org/project/six) - MIT
- [mbed-cloud-sdk](https://pypi.org/project/mbed-cloud-sdk) - Apache 2.0
- [requests](https://pypi.org/project/requests) - Apache-2.0
- [idna](https://pypi.org/project/idna) - BSD-3-Clause
- [pyserial](https://pypi.org/project/pyserial) - BSD-3-Clause
- [Jinja2](https://pypi.org/project/Jinja2) - BSD-3-Clause
- [intelhex](https://pypi.org/project/intelhex) - BSD
- [mbed-ls](https://pypi.org/project/mbed-ls) - Apache-2.0
- [mbed-host-tests](https://pypi.org/project/mbed-host-tests) - Apache-2.0
- [mbed-greentea](https://pypi.org/project/mbed-greentea) - Apache-2.0
- [beautifulsoup4](https://pypi.org/project/beautifulsoup4) - MIT
- [pyelftools](https://pypi.org/project/pyelftools) - Public Domain
- [manifest-tool](https://pypi.org/project/manifest-tool) - Apache-2.0
- [icetea](https://pypi.org/project/icetea) - Apache-2.0
- [pycryptodome](https://pypi.org/project/pycryptodome) - BSD-2-Clause
- [pyusb](https://pypi.org/project/pyusb/) - Apache-2.0
- [cmsis-pack-manager](https://pypi.org/project/cmsis-pack-manager) - Apache-2.0
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
[![Build status release][mbed-travis-release-svg]][mbed-travis-release]
[![Build status master][mbed-travis-master-svg]][mbed-travis-master]
[![Tools coverage status][mbed-coveralls-tools-svg]][mbed-coveralls-tools]
[![PR progress][mbed-waffle-svg]][mbed-waffle]

[mbed-os-logo]: logo.png
[mbed-os-link]: https://www.mbed.com/en/platform/mbed-os/
Expand All @@ -13,8 +12,6 @@
[mbed-travis-release-svg]: https://travis-ci.org/ARMmbed/mbed-os.svg?branch=latest
[mbed-coveralls-tools]: https://coveralls.io/github/ARMmbed/mbed-os?branch=master
[mbed-coveralls-tools-svg]: https://coveralls.io/repos/github/ARMmbed/mbed-os/badge.svg?branch=master
[mbed-waffle]: https://waffle.io/ARMmbed/mbed-os
[mbed-waffle-svg]: https://badge.waffle.io/ARMmbed/mbed-os.svg?columns=all

Arm Mbed OS is an open source embedded operating system designed specifically for the "things" in the Internet of Things. It includes all the features you need to develop a connected product based on an Arm Cortex-M microcontroller, including security, connectivity, an RTOS and drivers for sensors and I/O devices.

Expand All @@ -31,7 +28,7 @@ The [release notes](https://os.mbed.com/releases) detail the current release. Yo

The software is provided under the [Apache-2.0 license](LICENSE-apache-2.0.txt). Contributions to this project are accepted under the same license. Please see [contributing.md](CONTRIBUTING.md) for more information.

This project contains code from other projects. The original license text is included in those source files. They must comply with our [license guide](https://os.mbed.com/docs/latest/reference/license.html).
This project contains code from other projects. The original license text is included in those source files. They must comply with our [license guide](https://os.mbed.com/docs/mbed-os/latest/contributing/license.html).

Folders containing files under different permissive license than Apache 2.0 are listed in the [LICENSE](LICENSE) file.

Expand Down
240 changes: 240 additions & 0 deletions TESTS/host_tests/pyusb_msd.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,240 @@
"""
Copyright (c) 2019, Arm Limited and affiliates.
SPDX-License-Identifier: Apache-2.0
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""

from mbed_host_tests import BaseHostTest
import time
import psutil
import tempfile
import uuid
import os
import platform
import subprocess
import sys
system_name = platform.system()
if system_name == "Windows":
import wmi


class PyusbMSDTest(BaseHostTest):
"""Host side test for USB MSD class."""

__result = None
MOUNT_WAIT_TIME = 25 # in [s]
initial_disk_list = None
msd_disk = None
serial_number = None

def _callback_device_ready(self, key, value, timestamp):
"""Send a unique USB SN to the device.
DUT uses this SN every time it connects to host as a USB device.
"""
self.serial_number = uuid.uuid4().hex # 32 hex digit string
self.send_kv("serial_number", self.serial_number)

def _callback_check_file_exist(self, key, value, timestamp):
"""Check if file exist.
"""
folder_name, file_name, file_content = value.split(' ')
msd_disk = MSDUtils.disk_path(self.serial_number)
file_path = os.path.join(msd_disk, folder_name, file_name)
try:
file = open(file_path, 'r')
line = file.readline()
file.close()
time.sleep(2) # wait for msd communication done
if line == file_content:
self.send_kv("exist", "0")
return
self.report_error("file content invalid")
except IOError as err:
self.log('{} !!!'.format(err))
self.send_kv("non-exist", "0")

def _callback_delete_files(self, key, value, timestamp):
"""Delete test file.
"""
dir_name, file_name = value.split(' ')
msd_disk = MSDUtils.disk_path(self.serial_number)
try:
os.remove(os.path.join(msd_disk, dir_name, file_name))
except:
self.report_error("delete files")
return
time.sleep(2) # wait for msd communication done
self.report_success()

def _callback_check_if_mounted(self, key, value, timestamp):
"""Check if disk was mounted.
"""
wait_time = self.MOUNT_WAIT_TIME
while wait_time != 0:
msd_disk = MSDUtils.disk_path(self.serial_number)
if msd_disk is not None:
# MSD disk found
time.sleep(2) # wait for msd communication done
self.report_success()
return
wait_time -= 1
time.sleep(1) # wait 1s and try again
self.report_error("mount check")

def _callback_check_if_not_mounted(self, key, value, timestamp):
"""Check if disk was unmouted.
"""
wait_time = self.MOUNT_WAIT_TIME
while wait_time != 0:
msd_disk = MSDUtils.disk_path(self.serial_number)
if msd_disk is None:
#self.msd_disk = None
time.sleep(2) # wait for msd communication done
self.report_success()
return
wait_time -= 1
time.sleep(1) # wait 1s and try again
self.report_error("unmount check")

def _callback_get_mounted_fs_size(self, key, value, timestamp):
"""Record visible filesystem size.
"""
stats = psutil.disk_usage(MSDUtils.disk_path(self.serial_number))
self.send_kv("{}".format(stats.total), "0")

def _callback_unmount(self, key, value, timestamp):
"""Disk unmount.
"""
if MSDUtils.unmount(serial=self.serial_number):
self.report_success()
else:
self.report_error("unmount")

def setup(self):
self.register_callback("get_serial_number", self._callback_device_ready)
self.register_callback('check_if_mounted', self._callback_check_if_mounted)
self.register_callback('check_if_not_mounted', self._callback_check_if_not_mounted)
self.register_callback('get_mounted_fs_size', self._callback_get_mounted_fs_size)
self.register_callback('check_file_exist', self._callback_check_file_exist)
self.register_callback('delete_files', self._callback_delete_files)
self.register_callback('unmount', self._callback_unmount)

def report_success(self):
self.send_kv("passed", "0")

def report_error(self, msg):
self.log('{} failed !!!'.format(msg))
self.send_kv("failed", "0")

def result(self):
return self.__result

def teardown(self):
pass


class MSDUtils(object):

@staticmethod
def disk_path(serial):
system_name = platform.system()
if system_name == "Windows":
return MSDUtils._disk_path_windows(serial)
elif system_name == "Linux":
return MSDUtils._disk_path_linux(serial)
elif system_name == "Darwin":
return MSDUtils._disk_path_mac(serial)
return None

@staticmethod
def unmount(serial):
system_name = platform.system()
if system_name == "Windows":
return MSDUtils._unmount_windows(serial)
elif system_name == "Linux":
return MSDUtils._unmount_linux(serial)
elif system_name == "Darwin":
return MSDUtils._unmount_mac(serial)
return False

@staticmethod
def _disk_path_windows(serial):
serial_decoded = serial.encode("ascii")
c = wmi.WMI()
for physical_disk in c.Win32_DiskDrive():
if serial_decoded == physical_disk.SerialNumber:
for partition in physical_disk.associators("Win32_DiskDriveToDiskPartition"):
for logical_disk in partition.associators("Win32_LogicalDiskToPartition"):
return logical_disk.Caption
return None

@staticmethod
def _disk_path_linux(serial):
output = subprocess.check_output(['lsblk', '-dnoserial,mountpoint']).split('\n')
for line in output:
serial_and_mount_point = line.split()
if len(serial_and_mount_point) == 2:
if serial_and_mount_point[0] == str(serial):
return serial_and_mount_point[1]
return None

@staticmethod
def _disk_path_mac(serial):
# TODO:
# add implementation
return None

@staticmethod
def _unmount_windows(serial):
disk_path = MSDUtils._disk_path_windows(serial)
tmp_file = tempfile.NamedTemporaryFile(suffix='.ps1', delete=False)
try:
# create unmount script
tmp_file.write('$disk_leter=$args[0]\n')
tmp_file.write('$driveEject = New-Object -comObject Shell.Application\n')
tmp_file.write('$driveEject.Namespace(17).ParseName($disk_leter).InvokeVerb("Eject")\n')
# close to allow open by other process
tmp_file.close()

try_count = 10
while try_count:
p = subprocess.Popen(["powershell.exe", tmp_file.name + " " + disk_path], stdout=sys.stdout)
p.communicate()
try_count -= 1
if MSDUtils._disk_path_windows(serial) is None:
return True
time.sleep(1)
finally:
os.remove(tmp_file.name)

return False

@staticmethod
def _unmount_linux(serial):
disk_path = MSDUtils._disk_path_linux(serial)
os.system("umount " + disk_path)
return MSDUtils._disk_path_linux(serial) is None

@staticmethod
def _unmount_mac(serial):
disk_path = MSDUtils._disk_path_mac(serial)
os.system("diskutil unmount " + disk_path)
disks = set(MSDUtils._disks_mac())
return MSDUtils._disk_path_mac(serial) is None
2 changes: 0 additions & 2 deletions TESTS/mbed-crypto/sanity/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -438,9 +438,7 @@ utest::v1::status_t case_teardown_handler(const Case *const source, const size_t

utest::v1::status_t test_setup(const size_t number_of_cases)
{
#ifndef NO_GREENTEA
GREENTEA_SETUP(120, "default_auto");
#endif
return verbose_test_setup_handler(number_of_cases);
}

Expand Down
2 changes: 0 additions & 2 deletions TESTS/mbed_hal/spm/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,7 @@ Case cases[] = {

utest::v1::status_t greentea_test_setup(const size_t number_of_cases)
{
#ifndef NO_GREENTEA
GREENTEA_SETUP(20, "default_auto");
#endif
return greentea_test_setup_handler(number_of_cases);
}

Expand Down
Loading

0 comments on commit 0063e5d

Please sign in to comment.