aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorStephen Kyle <stephen.kyle@arm.com>2018-09-27 10:00:33 +0100
committerEugene Kliuchnikov <eustas@google.com>2018-09-27 11:00:33 +0200
commit67f059eaf5eb6cf9201ffe7776b48229a442d864 (patch)
tree0c92d35c51c1194bd3ac5fee0afc65547e42eec1 /tests
parent6eba239a5bb553fd557b7d78f7da8f0059618b9e (diff)
downloadbrotli-67f059eaf5eb6cf9201ffe7776b48229a442d864.zip
brotli-67f059eaf5eb6cf9201ffe7776b48229a442d864.tar.gz
brotli-67f059eaf5eb6cf9201ffe7776b48229a442d864.tar.bz2
Cross compilation support (#709)
* build: add cross-compilation support to make Set CROSS_COMPILE when running make to use the selected cross compilation toolchain, such as arm-linux-gnueabihf, or aarch64-linux-gnu. Testing requires the presence of qemu - 'qemu-$(ARCH)' will be executed, where ARCH is the first part of the toolchain triplet. * build: add cross-compilation support to cmake If C_COMPILER/CXX_COMPILER/CC/CXX are found to have cross-compilation triplets in front of the compiler, then qemu will be used to execute the tests. * CI: add arm-linux-gnueabihf-gcc builder to Travis The version of qemu available in Ubuntu trusty (as provided by Travis) appears to have a bug in qemu-aarch64, which leads to the compatibility tests failing on some inputs, erroneously rejecting the input as corrupt. Once Travis supports xenial, we could add an aarch64-gnu-linux-gcc builder as well. * CI: propagate cmake errors out of .travis.sh Seems like even if cmake fails, the error isn't picked up by Travis.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/compatibility_test.sh5
-rwxr-xr-xtests/roundtrip_test.sh5
-rw-r--r--tests/run-compatibility-test.cmake2
-rw-r--r--tests/run-roundtrip-test.cmake2
4 files changed, 12 insertions, 2 deletions
diff --git a/tests/compatibility_test.sh b/tests/compatibility_test.sh
index 4026fd9..c5af8bf 100755
--- a/tests/compatibility_test.sh
+++ b/tests/compatibility_test.sh
@@ -2,10 +2,13 @@
#
# Test that the brotli command-line tool can decompress old brotli-compressed
# files.
+#
+# The first argument may be a wrapper for brotli, such as 'qemu-arm'.
set -o errexit
-BROTLI=bin/brotli
+BROTLI_WRAPPER=$1
+BROTLI="${BROTLI_WRAPPER} bin/brotli"
TMP_DIR=bin/tmp
for file in tests/testdata/*.compressed*; do
diff --git a/tests/roundtrip_test.sh b/tests/roundtrip_test.sh
index 6c92418..90027af 100755
--- a/tests/roundtrip_test.sh
+++ b/tests/roundtrip_test.sh
@@ -1,10 +1,13 @@
#!/usr/bin/env bash
#
# Roundtrip test for the brotli command-line tool.
+#
+# The first argument may be a wrapper for brotli, such as 'qemu-arm'.
set -o errexit
-BROTLI=bin/brotli
+BROTLI_WRAPPER=$1
+BROTLI="${BROTLI_WRAPPER} bin/brotli"
TMP_DIR=bin/tmp
INPUTS="""
tests/testdata/alice29.txt
diff --git a/tests/run-compatibility-test.cmake b/tests/run-compatibility-test.cmake
index fd49db8..f594d98 100644
--- a/tests/run-compatibility-test.cmake
+++ b/tests/run-compatibility-test.cmake
@@ -2,6 +2,8 @@ string(REGEX REPLACE "([a-zA-Z0-9\\.]+)\\.compressed(\\.[0-9]+)?$" "\\1" REFEREN
string(REGEX REPLACE "\\.compressed" "" OUTPUT_FILE "${INPUT}")
get_filename_component(OUTPUT_NAME "${OUTPUT_FILE}" NAME)
+set(ENV{QEMU_LD_PREFIX} "${BROTLI_WRAPPER_LD_PREFIX}")
+
execute_process(
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
COMMAND ${BROTLI_WRAPPER} ${BROTLI_CLI} --force --decompress ${INPUT} --output=${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_NAME}.unbr
diff --git a/tests/run-roundtrip-test.cmake b/tests/run-roundtrip-test.cmake
index 08d4e01..39303d3 100644
--- a/tests/run-roundtrip-test.cmake
+++ b/tests/run-roundtrip-test.cmake
@@ -1,3 +1,5 @@
+set(ENV{QEMU_LD_PREFIX} "${BROTLI_WRAPPER_LD_PREFIX}")
+
execute_process(
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
COMMAND ${BROTLI_WRAPPER} ${BROTLI_CLI} --force --quality=${QUALITY} ${INPUT} --output=${OUTPUT}.br