Skip to content

Commit b009d0f

Browse files
committed
Travis with specific lc server download
1 parent 8113709 commit b009d0f

8 files changed

+2007
-0
lines changed

.travis.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
sudo: required
2+
dist: trusty
3+
4+
# Build on both Linux and OSX
5+
os:
6+
- linux
7+
- osx
8+
9+
language: bash
10+
11+
jdk:
12+
- openjdk8
13+
14+
# Download correct versions of livecode server
15+
install: |
16+
FETCH_DIR=_fetch
17+
mkdir -p ${FETCH_DIR}
18+
VERSION=9.0.3
19+
VERSION_FOR_URL="$(echo $VERSION | sed 's/\./_/g')"
20+
if [[ "$TRAVIS_OS_NAME" == "linux" ]] ; then
21+
ARCHIVE_NAME="LiveCodeCommunityServer-${VERSION_FOR_URL}-Linux-x86_64.zip"
22+
elif [[ "$TRAVIS_OS_NAME" == "osx" ]] ; then
23+
ARCHIVE_NAME="LiveCodeCommunityServer-${VERSION_FOR_URL}-Mac.zip"
24+
fi
25+
SERVER_URL="https://downloads.livecode.com/livecode/${VERSION_FOR_URL}/${ARCHIVE_NAME}"
26+
echo "${SERVER_URL}"
27+
curl -k "${SERVER_URL}" -o "${FETCH_DIR}/${ARCHIVE_NAME}" --fail
28+
EXTRACT_DIR=_download
29+
mkdir -p ${EXTRACT_DIR}
30+
unzip "${FETCH_DIR}/${ARCHIVE_NAME}" -d "${EXTRACT_DIR}"
31+
if [ $? -ne 0 ] ; then
32+
echo " unzip failed"
33+
exit 1
34+
fi
35+
chmod +x "${EXTRACT_DIR}/livecode-community-server"
36+
37+
# Run tests under LiveCode server
38+
script: |
39+
case "${TRAVIS_OS_NAME}" in
40+
linux)
41+
BUILD_PLATFORM=linux
42+
CHECK_COMMAND=xvfb-run
43+
;;
44+
osx)
45+
BUILD_PLATFORM=mac
46+
CHECK_COMMAND=
47+
export JAVA_HOME=$(/usr/libexec/java_home)
48+
;;
49+
esac
50+
export MODE=debug
51+
_download/livecode-community-server tests/_testrunner.lc run tests/test-scripts
52+
if [ $? -ne 0 ] ; then
53+
echo "Tests failed - dumping log file..."
54+
cat _test_suite.log
55+
exit 1
56+
fi
57+
58+
addons:
59+
# Packages needed for building LiveCode
60+
apt:
61+
packages:
62+
- gawk
63+
- libx11-dev
64+
- libxext-dev
65+
- libxrender-dev
66+
- libxft-dev
67+
- libxinerama-dev
68+
- libxv-dev
69+
- libxcursor-dev
70+
- libfreetype6-dev
71+
- libgtk2.0-dev
72+
- libpopt-dev
73+
- libesd0-dev
74+
- liblcms2-dev
75+
- xvfb
76+

tests/_inputlib.livecodescript

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
script "testInputLibrary"
2+
/*
3+
Copyright (C) 2015 LiveCode Ltd.
4+
5+
This file is part of LiveCode.
6+
7+
LiveCode is free software; you can redistribute it and/or modify it under
8+
the terms of the GNU General Public License v3 as published by the Free
9+
Software Foundation.
10+
11+
LiveCode is distributed in the hope that it will be useful, but WITHOUT ANY
12+
WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+
for more details.
15+
16+
You should have received a copy of the GNU General Public License
17+
along with LiveCode. If not see <http://www.gnu.org/licenses/>. */
18+
19+
on revLoadLibrary
20+
if the target is not me then
21+
pass revLoadLibrary
22+
end if
23+
insert the script of me into back
24+
end revLoadLibrary
25+
26+
local sTestStrings, sTestNumbers, sTestConversionStrings, sTestFilePaths, sArrayData
27+
local sInitialised
28+
29+
function TestGetInputFilesFolder
30+
set the itemDelimiter to slash
31+
return item 1 to -2 of the filename of me & slash & "lcs-input-files"
32+
end TestGetInputFilesFolder
33+
34+
private function getTestFile pTestFile
35+
local tContent, tFilePath
36+
37+
put TestGetInputFilesFolder() & slash & pTestFile into tFilePath
38+
39+
// test files are written without BOM
40+
open file tFilePath for "utf8" text read
41+
read from file tFilePath until EOF
42+
43+
put it into tContent
44+
45+
close file tFilePath
46+
return tContent
47+
end getTestFile
48+
49+
on setUpValues
50+
if sInitialised then
51+
exit setUpValues
52+
end if
53+
54+
put true into sInitialised
55+
56+
//load in strings
57+
local tStrings
58+
put getTestFile("testStrings.txt") into tStrings
59+
put empty into sArrayData
60+
61+
local tFirstLine
62+
put line 1 of tStrings into tFirstLine
63+
delete line 1 of tStrings
64+
65+
repeat for each line tLine in tStrings
66+
local tType, tNumber
67+
put item 1 of tLine into tType
68+
put item 2 of tLine into tNumber
69+
70+
put item 3 of tLine into sTestStrings[tType][tNumber][item 3 of tFirstLine]
71+
put item 4 of tLine into sTestStrings[tType][tNumber][item 4 of tFirstLine]
72+
put item 5 of tLine into sTestStrings[tType][tNumber][item 5 of tFirstLine]
73+
put item 6 of tLine into sTestStrings[tType][tNumber][item 6 of tFirstLine]
74+
end repeat
75+
76+
77+
//load in numbers
78+
local tNumbers
79+
put getTestFile("testNumbers.txt") into tNumbers
80+
81+
repeat for each line tLine in tNumbers
82+
put item 2 of tLine into sTestNumbers[item 1 of tLine][1]
83+
put item 3 of tLine into sTestNumbers[item 1 of tLine][2]
84+
end repeat
85+
86+
87+
// Load in conversion strings
88+
local tConversionStrings
89+
put getTestFile("testConversionStrings.txt") into tConversionStrings
90+
91+
repeat for each line tLine in tConversionStrings
92+
put item 2 of tLine into sTestConversionStrings[item 1 of tLine]["lowerCase"]
93+
put item 3 of tLine into sTestConversionStrings[item 1 of tLine]["upperCase"]
94+
put item 4 of tLine into sTestConversionStrings[item 1 of tLine]["lowerCaseNumber"]
95+
put item 5 of tLine into sTestConversionStrings[item 1 of tLine]["upperCaseNumber"]
96+
put item 6 of tLine into sTestConversionStrings[item 1 of tLine]["lowerCaseByte"]
97+
put item 7 of tLine into sTestConversionStrings[item 1 of tLine]["upperCaseByte"]
98+
end repeat
99+
100+
101+
// Load in file paths
102+
local tFilePaths
103+
put getTestFile("testFilePaths.txt") into tFilePaths
104+
105+
repeat for each line tLine in tFilePaths
106+
put item 2 of tLine into sTestFilePaths[item 1 of tLine]
107+
end repeat
108+
109+
110+
// Load in array data
111+
local tArrayData
112+
put getTestFile("testArrayData.txt") into tArrayData
113+
114+
repeat for each line tLine in tArrayData
115+
put item 2 to -1 of tLine into sArrayData[item 1 of tLine]
116+
end repeat
117+
end setUpValues
118+
119+
function testString pType,pNumber, pValue
120+
setupValues
121+
if pValue is empty then put "string" into pValue
122+
put "String:" && pType, pNumber, pValue && sTestStrings[pType][pNumber][pValue]& return after url ("binfile:" & specialFolderPath("desktop") & "/log.txt")
123+
return sTestStrings[pType][pNumber][pValue]
124+
end testString
125+
126+
function testNumber pType,pNumber
127+
setupValues
128+
return sTestNumbers[pType][pNumber]
129+
end testNumber
130+
131+
function testConversionString pStringType, pConversionType
132+
setupValues
133+
return sTestConversionStrings[pStringType][pConversionType]
134+
end testConversionString
135+
136+
function testFilePath pType
137+
setupValues
138+
return sTestFilePaths[pType]
139+
end testFilePath
140+
141+
function testFolderList
142+
setupValues
143+
local tFileList
144+
repeat for each element tFile in sTestFilePaths
145+
put tFile & return after tFileList
146+
end repeat
147+
delete the last character of tFileList
148+
return tFileList
149+
end testFolderList
150+
151+
function testFileList
152+
setupValues
153+
local tFileList
154+
repeat for each element tFile in sTestFilePaths
155+
put tFile & ".txt" & return after tFileList
156+
end repeat
157+
delete the last character of tFileList
158+
return tFileList
159+
end testFileList
160+
161+
function testArrayData pKey
162+
setupValues
163+
return sArrayData[pKey]
164+
end testArrayData
165+
166+
function TestGetInputFile pFilename
167+
return TestGetInputFilesFolder() & slash & pFilename
168+
end TestGetInputFile

0 commit comments

Comments
 (0)