Skip to content

Commit 999d946

Browse files
authored
Merge pull request #256 from screamerbg/extended-tests
Comprehensive workflow end-to-end testing
2 parents 572ead0 + 88fcdca commit 999d946

File tree

3 files changed

+81
-3
lines changed

3 files changed

+81
-3
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ var/
2626
*.egg-info/
2727
.installed.cfg
2828
*.egg
29+
.tests
2930

3031
# PyInstaller
3132
# Usually these files are written by a python script from a template

circle.yml

+28-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,35 @@
11
test:
22
override:
3+
- mbed --version
34
- py.test test
5+
- mbed toolchain -G GCC_ARM
6+
- mbed target -G K64F
7+
- mbed config -G protocol ssh
8+
- cd .tests && mbed new new-test
9+
- cd .tests/new-test && mbed ls
10+
- cd .tests/new-test/mbed-os/core && pip install -r requirements.txt
11+
- cd .tests/new-test && mbed compile --source=. --source=mbed-os/TESTS/integration/basic -j 0
12+
- cd .tests/new-test && mbed test --compile -n tests-integration-threaded_blinky -j 0
13+
- cd .tests && mbed import https://github.com/ARMmbed/mbed-Client-example-temp git-test
14+
- cd .tests/git-test && mbed update 2d9404a4f88db7de0e5a9ea2acdbca1aeacab9c4 --clean
15+
- cd .tests/git-test && mbed update master --clean
16+
- cd .tests/git-test && mbed compile -j 0
17+
- cd .tests && mbed import https://developer.mbed.org/teams/Morpheus/code/mbed-Client-Morpheus-hg hg-test
18+
- cd .tests/hg-test && mbed update b02527cafcde8612ff051fea57e9975aca598807 --clean
19+
- cd .tests/hg-test && mbed update --clean
20+
- cd .tests/hg-test && mbed compile -j 0
21+
- cd .tests && mbed import https://developer.mbed.org/users/samux/code/USBSerial_HelloWorld bld-test
22+
- cd .tests/bld-test/mbed && mbed update 85 --clean
23+
- cd .tests/bld-test && mbed update --clean
24+
- cd .tests/bld-test && mbed compile -m LPC1768 -j 0
425

526
dependencies:
627
pre:
728
- sudo pip install pytest
8-
- git config --global user.email "[email protected]"
9-
- git config --global user.name "Tester"
10-
- echo -e "[ui]\nusername = Tester <[email protected]>\n" > ~/.hgrc
29+
- git config --global user.email "[email protected]"
30+
- git config --global user.name "mbed Test"
31+
- echo -e "[ui]\nusername = mbed Test <[email protected]>\n" > ~/.hgrc
32+
- mkdir .tests
33+
- sudo add-apt-repository -y ppa:terry.guo/gcc-arm-embedded
34+
- sudo apt-get -y update
35+
- sudo apt-get -y install gcc-arm-none-eabi=4.9.3.2015q3-1precise1

circle_tests.py

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/usr/bin/env python
2+
3+
# Copyright (c) 2016 ARM Limited, All Rights Reserved
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
9+
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
10+
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
14+
# either express or implied.
15+
16+
import os
17+
import sys
18+
import subprocess
19+
import shutil
20+
import yaml
21+
22+
def rmtree_readonly(directory):
23+
def remove_readonly(func, path, _):
24+
os.chmod(path, stat.S_IWRITE)
25+
func(path)
26+
27+
shutil.rmtree(directory, onerror=remove_readonly)
28+
29+
tests = None
30+
with open("circle.yml", "r") as f:
31+
types = yaml.load_all(f)
32+
for t in types:
33+
for k,v in t.items():
34+
if k == 'test':
35+
tests = v['override']
36+
37+
if tests:
38+
cwd = os.path.abspath(os.path.dirname(__file__))
39+
40+
if os.path.exists(os.path.join(cwd, '.tests')):
41+
rmtree_readonly(os.path.join(cwd, '.tests'))
42+
os.mkdir(os.path.join(cwd, '.tests'))
43+
44+
for cmd in tests:
45+
os.chdir(cwd)
46+
print "\n----------\nEXEC: \"%s\" " % cmd
47+
proc = subprocess.Popen(cmd, shell=True)
48+
proc.communicate()
49+
50+
if proc.returncode != 0:
51+
print "\n------------\nERROR: \"%s\"" % cmd
52+
sys.exit(1)

0 commit comments

Comments
 (0)