Skip to content

Commit e1e0368

Browse files
wangnuannuanfanghuaqi
authored andcommitted
travis: travis build configuration
Signed-off-by: Jingru Wang <jingru@synopsys.com>
1 parent f4c6bc5 commit e1e0368

File tree

3 files changed

+128
-0
lines changed

3 files changed

+128
-0
lines changed

.travis/before_install.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
die() {
2+
3+
echo " *** ERROR: " $*
4+
5+
exit 1
6+
7+
}
8+
set -x
9+
10+
cd /tmp || die
11+
[ $TRAVIS_OS_NAME != linux ] || {
12+
13+
sudo apt-get update || die
14+
sudo apt-get install lib32z1 || die
15+
sudo apt-get install dos2unix || die
16+
wget https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain/releases/download/arc-2017.09-release/arc_gnu_2017.09_prebuilt_elf32_le_linux_install.tar.gz || die
17+
tar xzf arc_gnu_2017.09_prebuilt_elf32_le_linux_install.tar.gz || die
18+
export PATH=/tmp/arc_gnu_2017.09_prebuilt_elf32_le_linux_install/bin:$PATH || die
19+
arc-elf32-gcc --version || die
20+
sudo apt-get install doxygen || die
21+
sudo pip install --upgrade pip || die
22+
sudo pip install git+https://github.com/sphinx-doc/sphinx || die
23+
sudo pip install breathe || die
24+
sudo pip install recommonmark || die
25+
sudo pip install sphinx_rtd_theme || die
26+
}

.travis/build.py

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import json
2+
import os
3+
import sys
4+
5+
folder = ".travis"
6+
make_path = dict()
7+
makefile = 'makefile'
8+
9+
def get_makefile(path): # to find the makefile in the embarc_applications
10+
path = os.path.abspath(path)
11+
for root, dirs, files in os.walk(path):
12+
dirs[:] = [d for d in dirs if not d.startswith('.')]
13+
for f in files:
14+
if f == makefile:
15+
key = os.path.basename(root)+'_'+os.path.basename(os.path.dirname(root))
16+
make_path[key] = root
17+
18+
def embarc_makefile(paths): # to confirm the file is a embarc makefile
19+
for (k,v) in paths.items():
20+
with open(os.path.join(v,"makefile")) as f:
21+
embarc_root = False
22+
appl = False
23+
lines = f.read().splitlines()
24+
for line in lines:
25+
if "EMBARC_ROOT" in line:
26+
embarc_root = True
27+
if "APPL" in line:
28+
appl = True
29+
if not (embarc_root and appl):
30+
paths.pop(k)
31+
32+
if __name__ == '__main__':
33+
result = {}
34+
cwd_path = os.getcwd() # /travis
35+
applications_path = os.path.dirname(cwd_path) # # /embarc_application
36+
osp_application = applications_path+"/embarc_osp/embarc_applications"# /embarc_osp/application
37+
38+
os.chdir(os.path.join(applications_path,"embarc_osp"))
39+
get_makefile(osp_application)
40+
embarc_makefile(make_path)
41+
for (k,v) in make_path.items():
42+
result[k] = 0
43+
print("application[%s]=" %k,v)
44+
pathin = v.replace("\\", "/")
45+
os.chdir(pathin)
46+
os.system("make "+sys.argv[1]+" clean")
47+
48+
if os.system("make "+sys.argv[1]+" -k") != 0:
49+
50+
result[k] = 1
51+
pathout = cwd_path
52+
os.chdir(pathout)
53+
print(result)
54+
for (k,v) in result.items():
55+
if v == 1:
56+
sys.exit(1)
57+
sys.exit(0)

.travis/script.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
embARC_OSP_REPO="https://github.com/foss-for-synopsys-dwc-arc-processors/embarc_osp.git"
2+
3+
die() {
4+
echo " *** ERROR: " $*
5+
exit 1
6+
7+
}
8+
set -x
9+
10+
[ $TRAVIS_OS_NAME != linux ] || {
11+
12+
export PATH=/tmp/arc_gnu_2017.09_prebuilt_elf32_le_linux_install/bin:$PATH || die
13+
git checkout -- . || die
14+
cd ../ || die
15+
tar -czvf application.tar.gz embarc_applications || die
16+
cd embarc_applications || die
17+
git clone ${embARC_OSP_REPO} embarc_osp
18+
cd embarc_osp || die
19+
tar -zxvf ../../application.tar.gz || die
20+
bash apply_embARC_patch.sh || die
21+
cd ../ || die
22+
cd .travis || die
23+
[ $TOOLCHAIN != gnu -o $BOARD != emsk -o $BD_VER != 11 -o $CUR_CORE != arcem6 ] || {
24+
25+
python3 build.py "TOOLCHAIN=${TOOLCHAIN} BOARD=${BOARD} BD_VER=${BD_VER} CUR_CORE=${CUR_CORE}" || die
26+
}
27+
[ $TOOLCHAIN != gnu -o $BOARD != emsk -o $BD_VER != 22 -o $CUR_CORE != arcem7d ] || {
28+
29+
python3 build.py "TOOLCHAIN=${TOOLCHAIN} BOARD=${BOARD} BD_VER=${BD_VER} CUR_CORE=${CUR_CORE}" || die
30+
}
31+
32+
[ $TOOLCHAIN != gnu -o $BOARD != emsk -o $BD_VER != 22 -o $CUR_CORE != arcem11d ] || {
33+
34+
python3 build.py "TOOLCHAIN=${TOOLCHAIN} BOARD=${BOARD} BD_VER=${BD_VER} CUR_CORE=${CUR_CORE}" || die
35+
}
36+
[ $TOOLCHAIN != gnu -o $BOARD != emsk -o $BD_VER != 23 -o $CUR_CORE != arcem7d ] || {
37+
38+
python3 build.py "TOOLCHAIN=${TOOLCHAIN} BOARD=${BOARD} BD_VER=${BD_VER} CUR_CORE=${CUR_CORE}" || die
39+
}
40+
[ $TOOLCHAIN != gnu -o $BOARD != emsk -o $BD_VER != 23 -o $CUR_CORE != arcem11d ] || {
41+
42+
python3 build.py "TOOLCHAIN=${TOOLCHAIN} BOARD=${BOARD} BD_VER=${BD_VER} CUR_CORE=${CUR_CORE}" || die
43+
}
44+
45+
}

0 commit comments

Comments
 (0)