xref: /aosp_15_r20/external/libpng/scripts/cmake/test.cmake.in (revision a67afe4df73cf47866eedc69947994b8ff839aba)
1*a67afe4dSAndroid Build Coastguard Worker# test.cmake.in
2*a67afe4dSAndroid Build Coastguard Worker
3*a67afe4dSAndroid Build Coastguard Worker# Copyright (c) 2024 Cosmin Truta
4*a67afe4dSAndroid Build Coastguard Worker# Copyright (c) 2016 Glenn Randers-Pehrson
5*a67afe4dSAndroid Build Coastguard Worker# Written by Roger Leigh, 2016
6*a67afe4dSAndroid Build Coastguard Worker#
7*a67afe4dSAndroid Build Coastguard Worker# Use, modification and distribution are subject to
8*a67afe4dSAndroid Build Coastguard Worker# the same licensing terms and conditions as libpng.
9*a67afe4dSAndroid Build Coastguard Worker# Please see the copyright notice in png.h or visit
10*a67afe4dSAndroid Build Coastguard Worker# http://libpng.org/pub/png/src/libpng-LICENSE.txt
11*a67afe4dSAndroid Build Coastguard Worker#
12*a67afe4dSAndroid Build Coastguard Worker# SPDX-License-Identifier: libpng-2.0
13*a67afe4dSAndroid Build Coastguard Worker
14*a67afe4dSAndroid Build Coastguard Workerset(TEST_OPTIONS "@TEST_OPTIONS@")
15*a67afe4dSAndroid Build Coastguard Workerset(TEST_FILES "@TEST_FILES@")
16*a67afe4dSAndroid Build Coastguard Worker
17*a67afe4dSAndroid Build Coastguard Workerforeach(file ${TEST_FILES})
18*a67afe4dSAndroid Build Coastguard Worker  file(TO_NATIVE_PATH "${file}" native_file)
19*a67afe4dSAndroid Build Coastguard Worker  list(APPEND NATIVE_TEST_FILES "${native_file}")
20*a67afe4dSAndroid Build Coastguard Workerendforeach()
21*a67afe4dSAndroid Build Coastguard Worker
22*a67afe4dSAndroid Build Coastguard Worker# Add the directory containing libpng to the PATH (Windows only)
23*a67afe4dSAndroid Build Coastguard Workerif(WIN32)
24*a67afe4dSAndroid Build Coastguard Worker  get_filename_component(LIBPNG_DIR "${LIBPNG}" PATH)
25*a67afe4dSAndroid Build Coastguard Worker  file(TO_NATIVE_PATH "${LIBPNG_DIR}" LIBPNG_DIR)
26*a67afe4dSAndroid Build Coastguard Worker  set(ENV{PATH} "${LIBPNG_DIR};$ENV{PATH}")
27*a67afe4dSAndroid Build Coastguard Workerendif()
28*a67afe4dSAndroid Build Coastguard Worker
29*a67afe4dSAndroid Build Coastguard Workermessage("Running ${TEST_COMMAND}" ${TEST_OPTIONS} ${NATIVE_TEST_FILES})
30*a67afe4dSAndroid Build Coastguard Workerexecute_process(COMMAND "${TEST_COMMAND}" ${TEST_OPTIONS} ${NATIVE_TEST_FILES}
31*a67afe4dSAndroid Build Coastguard Worker                RESULT_VARIABLE TEST_STATUS)
32*a67afe4dSAndroid Build Coastguard Workerif(TEST_STATUS)
33*a67afe4dSAndroid Build Coastguard Worker  message(FATAL_ERROR "Returned failed status ${TEST_STATUS}!")
34*a67afe4dSAndroid Build Coastguard Workerendif()
35