1#
2# Copyright (c) 2017, Alliance for Open Media. All rights reserved
3#
4# This source code is subject to the terms of the BSD 2 Clause License and the
5# Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License was
6# not distributed with this source code in the LICENSE file, you can obtain it
7# at www.aomedia.org/license/software. If the Alliance for Open Media Patent
8# License 1.0 was not distributed with this source code in the PATENTS file, you
9# can obtain it at www.aomedia.org/license/patent.
10#
11if(NOT GTEST_TOTAL_SHARDS
12   OR "${GTEST_SHARD_INDEX}" STREQUAL ""
13   OR NOT TEST_LIBAOM)
14  message(
15    FATAL_ERROR
16      "The variables GTEST_SHARD_INDEX, GTEST_TOTAL_SHARDS and TEST_LIBAOM
17          must be defined.")
18endif()
19
20set($ENV{GTEST_SHARD_INDEX} ${GTEST_SHARD_INDEX})
21set($ENV{GTEST_TOTAL_SHARDS} ${GTEST_TOTAL_SHARDS})
22execute_process(COMMAND ${TEST_LIBAOM} RESULT_VARIABLE test_result)
23set(test_message "Test shard ${GTEST_SHARD_INDEX}/${GTEST_TOTAL_SHARDS} result")
24message("${test_message}: ${test_result}")
25
26if(NOT "${test_result}" STREQUAL "0")
27  message(FATAL_ERROR "${test_message}: FAILED, non-zero exit code.")
28endif()
29