build: turn on integration tests in ctest by default (#1381)
They can still be skipped by passing `-DSKIP_INTEGRATION_TESTS=ON` for the build configuration. Fix integration tests so they run correctly when building out of tree. Use FindPython3 in CMake to fix build and integration tests on Windows.
This commit is contained in:
parent
ceeb378a85
commit
84009d82ef
|
@ -26,7 +26,7 @@ option(FULLY_STATIC "Attempt fully static linking of all CLI apps" OFF)
|
||||||
# Enable CMake's test infrastructure.
|
# Enable CMake's test infrastructure.
|
||||||
enable_testing()
|
enable_testing()
|
||||||
|
|
||||||
option(SKIP_INTEGRATION_TESTS "Skip the packager integration tests" ON)
|
option(SKIP_INTEGRATION_TESTS "Skip the packager integration tests" OFF)
|
||||||
|
|
||||||
# Subdirectories with their own CMakeLists.txt
|
# Subdirectories with their own CMakeLists.txt
|
||||||
add_subdirectory(packager)
|
add_subdirectory(packager)
|
||||||
|
|
|
@ -13,7 +13,7 @@ if(BUILD_SHARED_LIBS)
|
||||||
|
|
||||||
# Custom commands aren't targets, but have outputs.
|
# Custom commands aren't targets, but have outputs.
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
DEPENDS mpd_generator packager libpackager
|
DEPENDS mpd_generator packager libpackager pssh_box_py
|
||||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||||
OUTPUT ${TEST_INSTALL_DIR}
|
OUTPUT ${TEST_INSTALL_DIR}
|
||||||
COMMAND
|
COMMAND
|
||||||
|
|
|
@ -66,6 +66,11 @@ include("gtest.cmake")
|
||||||
# Include our module for building protos.
|
# Include our module for building protos.
|
||||||
include("protobuf.cmake")
|
include("protobuf.cmake")
|
||||||
|
|
||||||
|
# Find Python3 used by integration tests, license notice and version string
|
||||||
|
if(NOT Python3_EXECUTABLE)
|
||||||
|
find_package(Python3 COMPONENTS Interpreter REQUIRED)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Subdirectories with their own CMakeLists.txt, all of whose targets are built.
|
# Subdirectories with their own CMakeLists.txt, all of whose targets are built.
|
||||||
add_subdirectory(file)
|
add_subdirectory(file)
|
||||||
add_subdirectory(kv_pairs)
|
add_subdirectory(kv_pairs)
|
||||||
|
@ -228,9 +233,22 @@ add_custom_target(packager_test_py_copy ALL
|
||||||
|
|
||||||
if(NOT SKIP_INTEGRATION_TESTS)
|
if(NOT SKIP_INTEGRATION_TESTS)
|
||||||
add_test (NAME packager_test_py
|
add_test (NAME packager_test_py
|
||||||
COMMAND ${PYTHON_EXECUTABLE} packager_test.py
|
COMMAND "${Python3_EXECUTABLE}" packager_test.py
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
set(test_environment_vars "PACKAGER_SRC_DIR=${CMAKE_SOURCE_DIR}")
|
||||||
|
list(APPEND test_environment_vars "PACKAGER_BIN=$<TARGET_FILE:packager>")
|
||||||
|
list(APPEND test_environment_vars "MPD_GENERATOR_BIN=$<TARGET_FILE:mpd_generator>")
|
||||||
|
if(BUILD_SHARED_LIBS)
|
||||||
|
list(APPEND test_environment_vars "BUILD_TYPE=shared")
|
||||||
|
else()
|
||||||
|
list(APPEND test_environment_vars "BUILD_TYPE=static")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set_tests_properties(packager_test_py PROPERTIES
|
||||||
|
ENVIRONMENT "${test_environment_vars}"
|
||||||
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
configure_file(packager.pc.in packager.pc @ONLY)
|
configure_file(packager.pc.in packager.pc @ONLY)
|
||||||
|
@ -238,12 +256,6 @@ configure_file(packager.pc.in packager.pc @ONLY)
|
||||||
# Always install the binaries.
|
# Always install the binaries.
|
||||||
install(TARGETS mpd_generator packager)
|
install(TARGETS mpd_generator packager)
|
||||||
|
|
||||||
# Always install the python tools.
|
|
||||||
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/pssh-box.py
|
|
||||||
DESTINATION ${CMAKE_INSTALL_BINDIR})
|
|
||||||
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/pssh-box-protos
|
|
||||||
DESTINATION ${CMAKE_INSTALL_BINDIR})
|
|
||||||
|
|
||||||
# With shared libraries, also install the library, headers, and pkgconfig.
|
# With shared libraries, also install the library, headers, and pkgconfig.
|
||||||
# The static library isn't usable as a standalone because it doesn't include
|
# The static library isn't usable as a standalone because it doesn't include
|
||||||
# its static dependencies (zlib, absl, etc).
|
# its static dependencies (zlib, absl, etc).
|
||||||
|
|
|
@ -17,10 +17,8 @@ class PackagerApp(object):
|
||||||
"""Main integration class for testing the packager binaries."""
|
"""Main integration class for testing the packager binaries."""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.packager_binary = os.path.join(test_env.SCRIPT_DIR,
|
self.packager_binary = test_env.PACKAGER_BIN
|
||||||
self._GetBinaryName('packager'))
|
self.mpd_generator_binary = test_env.MPD_GENERATOR_BIN
|
||||||
self.mpd_generator_binary = os.path.join(
|
|
||||||
test_env.SCRIPT_DIR, self._GetBinaryName('mpd_generator'))
|
|
||||||
# Set this to empty for now in case GetCommandLine() is called before
|
# Set this to empty for now in case GetCommandLine() is called before
|
||||||
# Package().
|
# Package().
|
||||||
self.packaging_command_line = ''
|
self.packaging_command_line = ''
|
||||||
|
@ -28,15 +26,10 @@ class PackagerApp(object):
|
||||||
'Please run from output directory, e.g. out/Debug/packager_test.py\n'
|
'Please run from output directory, e.g. out/Debug/packager_test.py\n'
|
||||||
' Missing: ' + self.packager_binary)
|
' Missing: ' + self.packager_binary)
|
||||||
|
|
||||||
def _GetBinaryName(self, name):
|
|
||||||
if platform.system() == 'Windows':
|
|
||||||
name += '.exe'
|
|
||||||
return name
|
|
||||||
|
|
||||||
def GetEnv(self):
|
def GetEnv(self):
|
||||||
env = os.environ.copy()
|
env = os.environ.copy()
|
||||||
if (platform.system() == 'Darwin' and
|
if (platform.system() == 'Darwin' and
|
||||||
test_env.options.libpackager_type == 'shared_library'):
|
test_env.BUILD_TYPE == 'shared'):
|
||||||
env['DYLD_FALLBACK_LIBRARY_PATH'] = test_env.SCRIPT_DIR
|
env['DYLD_FALLBACK_LIBRARY_PATH'] = test_env.SCRIPT_DIR
|
||||||
return env
|
return env
|
||||||
|
|
||||||
|
|
|
@ -485,7 +485,7 @@ class PackagerAppTest(unittest.TestCase):
|
||||||
use_fake_clock=True,
|
use_fake_clock=True,
|
||||||
allow_codec_switching=False,
|
allow_codec_switching=False,
|
||||||
dash_force_segment_list=False,
|
dash_force_segment_list=False,
|
||||||
force_cl_index=False):
|
force_cl_index=None):
|
||||||
|
|
||||||
flags = ['--single_threaded']
|
flags = ['--single_threaded']
|
||||||
|
|
||||||
|
@ -570,8 +570,10 @@ class PackagerAppTest(unittest.TestCase):
|
||||||
if allow_codec_switching:
|
if allow_codec_switching:
|
||||||
flags += ['--allow_codec_switching']
|
flags += ['--allow_codec_switching']
|
||||||
|
|
||||||
if force_cl_index:
|
if force_cl_index is True:
|
||||||
flags += ['--force_cl_index']
|
flags += ['--force_cl_index']
|
||||||
|
elif force_cl_index is False:
|
||||||
|
flags += ['--noforce_cl_index']
|
||||||
|
|
||||||
if ad_cues:
|
if ad_cues:
|
||||||
flags += ['--ad_cues', ad_cues]
|
flags += ['--ad_cues', ad_cues]
|
||||||
|
@ -754,7 +756,8 @@ class PackagerFunctionalTest(PackagerAppTest):
|
||||||
self._GetStream('video', trick_play_factor=2),
|
self._GetStream('video', trick_play_factor=2),
|
||||||
]
|
]
|
||||||
|
|
||||||
self.assertPackageSuccess(streams, self._GetFlags(output_dash=True))
|
self.assertPackageSuccess(streams, self._GetFlags(output_dash=True,
|
||||||
|
force_cl_index=False))
|
||||||
self._CheckTestResults('audio-video-with-two-trick-play')
|
self._CheckTestResults('audio-video-with-two-trick-play')
|
||||||
|
|
||||||
def testAudioVideoWithTwoTrickPlayDecreasingRate(self):
|
def testAudioVideoWithTwoTrickPlayDecreasingRate(self):
|
||||||
|
@ -765,7 +768,8 @@ class PackagerFunctionalTest(PackagerAppTest):
|
||||||
self._GetStream('video', trick_play_factor=1),
|
self._GetStream('video', trick_play_factor=1),
|
||||||
]
|
]
|
||||||
|
|
||||||
self.assertPackageSuccess(streams, self._GetFlags(output_dash=True))
|
self.assertPackageSuccess(streams, self._GetFlags(output_dash=True,
|
||||||
|
force_cl_index=False))
|
||||||
# Since the stream descriptors are sorted in packager app, a different
|
# Since the stream descriptors are sorted in packager app, a different
|
||||||
# order of trick play factors gets the same mpd.
|
# order of trick play factors gets the same mpd.
|
||||||
self._CheckTestResults('audio-video-with-two-trick-play')
|
self._CheckTestResults('audio-video-with-two-trick-play')
|
||||||
|
@ -1510,8 +1514,8 @@ class PackagerFunctionalTest(PackagerAppTest):
|
||||||
|
|
||||||
# TODO(kqyang): Fix shared_library not supporting strip_parameter_set_nalus
|
# TODO(kqyang): Fix shared_library not supporting strip_parameter_set_nalus
|
||||||
# problem.
|
# problem.
|
||||||
@unittest.skipUnless(
|
@unittest.skipIf(
|
||||||
test_env.options.libpackager_type == 'static_library',
|
test_env.BUILD_TYPE == 'shared',
|
||||||
'libpackager shared_library does not support '
|
'libpackager shared_library does not support '
|
||||||
'--strip_parameter_set_nalus flag.'
|
'--strip_parameter_set_nalus flag.'
|
||||||
)
|
)
|
||||||
|
|
|
@ -14,21 +14,38 @@ flags through the command line interface.
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
|
import platform
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
def GetBinaryName(name):
|
||||||
|
if platform.system() == 'Windows':
|
||||||
|
name += '.exe'
|
||||||
|
return name
|
||||||
|
|
||||||
# Define static global objects and attributes.
|
# Define static global objects and attributes.
|
||||||
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
|
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
|
||||||
|
SRC_DIR = os.environ.get('PACKAGER_SRC_DIR')
|
||||||
|
if not SRC_DIR:
|
||||||
|
# fallback to computing src dir from script dir
|
||||||
SRC_DIR = os.path.join(SCRIPT_DIR, os.pardir, os.pardir)
|
SRC_DIR = os.path.join(SCRIPT_DIR, os.pardir, os.pardir)
|
||||||
|
|
||||||
|
PACKAGER_BIN = os.environ.get('PACKAGER_BIN')
|
||||||
|
if not PACKAGER_BIN:
|
||||||
|
PACKAGER_BIN = os.path.join(SCRIPT_DIR,
|
||||||
|
GetBinaryName('packager'))
|
||||||
|
|
||||||
|
MPD_GENERATOR_BIN = os.environ.get('MPD_GENERATOR_BIN')
|
||||||
|
if not MPD_GENERATOR_BIN:
|
||||||
|
MPD_GENERATOR_BIN = os.path.join(SCRIPT_DIR,
|
||||||
|
GetBinaryName('mpd_generator'))
|
||||||
|
|
||||||
|
BUILD_TYPE = os.environ.get('BUILD_TYPE', 'static')
|
||||||
|
|
||||||
# Parse arguments and calculate dynamic global objects and attributes.
|
# Parse arguments and calculate dynamic global objects and attributes.
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
|
|
||||||
parser.add_argument('--test_update_golden_files', action='store_true')
|
parser.add_argument('--test_update_golden_files', action='store_true')
|
||||||
|
|
||||||
parser.add_argument('--libpackager_type', default='static_library',
|
|
||||||
choices=['static_library', 'shared_library'])
|
|
||||||
|
|
||||||
parser.add_argument('--v')
|
parser.add_argument('--v')
|
||||||
parser.add_argument('--vmodule')
|
parser.add_argument('--vmodule')
|
||||||
# Overwrite the test to encryption key/iv specified in the command line.
|
# Overwrite the test to encryption key/iv specified in the command line.
|
||||||
|
|
|
@ -2,8 +2,31 @@
|
||||||
<!--Generated with https://github.com/shaka-project/shaka-packager version <tag>-<hash>-<test>-->
|
<!--Generated with https://github.com/shaka-project/shaka-packager version <tag>-<hash>-<test>-->
|
||||||
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011" minBufferTime="PT2S" type="static" mediaPresentationDuration="PT2.736067S">
|
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011" minBufferTime="PT2S" type="static" mediaPresentationDuration="PT2.736067S">
|
||||||
<Period id="0">
|
<Period id="0">
|
||||||
<AdaptationSet id="0" contentType="audio" subsegmentStartsWithSAP="1" subsegmentAlignment="true">
|
<AdaptationSet id="0" contentType="video" width="640" height="360" frameRate="30000/1001" subsegmentAlignment="true" par="16:9">
|
||||||
<Representation id="0" bandwidth="133334" codecs="mp4a.40.2" mimeType="audio/mp4" audioSamplingRate="44100">
|
<Representation id="0" bandwidth="973483" codecs="avc1.64001e" mimeType="video/mp4" sar="1:1">
|
||||||
|
<BaseURL>bear-640x360-video.mp4</BaseURL>
|
||||||
|
<SegmentBase indexRange="870-937" timescale="30000">
|
||||||
|
<Initialization range="0-869"/>
|
||||||
|
</SegmentBase>
|
||||||
|
</Representation>
|
||||||
|
</AdaptationSet>
|
||||||
|
<AdaptationSet id="1" contentType="video" width="640" height="360" maxFrameRate="30000/22022" par="16:9">
|
||||||
|
<EssentialProperty schemeIdUri="http://dashif.org/guidelines/trickmode" value="0"/>
|
||||||
|
<Representation id="1" bandwidth="211545" codecs="avc1.64001e" mimeType="video/mp4" sar="1:1" frameRate="30000/30030" maxPlayoutRate="30" codingDependency="false">
|
||||||
|
<BaseURL>bear-640x360-video-trick_play_factor_1.mp4</BaseURL>
|
||||||
|
<SegmentBase indexRange="870-937" timescale="30000">
|
||||||
|
<Initialization range="0-869"/>
|
||||||
|
</SegmentBase>
|
||||||
|
</Representation>
|
||||||
|
<Representation id="2" bandwidth="211545" codecs="avc1.64001e" mimeType="video/mp4" sar="1:1" frameRate="30000/22022" maxPlayoutRate="60" codingDependency="false">
|
||||||
|
<BaseURL>bear-640x360-video-trick_play_factor_2.mp4</BaseURL>
|
||||||
|
<SegmentBase indexRange="870-925" timescale="30000">
|
||||||
|
<Initialization range="0-869"/>
|
||||||
|
</SegmentBase>
|
||||||
|
</Representation>
|
||||||
|
</AdaptationSet>
|
||||||
|
<AdaptationSet id="2" contentType="audio" subsegmentStartsWithSAP="1" subsegmentAlignment="true">
|
||||||
|
<Representation id="3" bandwidth="133334" codecs="mp4a.40.2" mimeType="audio/mp4" audioSamplingRate="44100">
|
||||||
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
|
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
|
||||||
<BaseURL>bear-640x360-audio.mp4</BaseURL>
|
<BaseURL>bear-640x360-audio.mp4</BaseURL>
|
||||||
<SegmentBase indexRange="804-871" timescale="44100">
|
<SegmentBase indexRange="804-871" timescale="44100">
|
||||||
|
@ -11,28 +34,5 @@
|
||||||
</SegmentBase>
|
</SegmentBase>
|
||||||
</Representation>
|
</Representation>
|
||||||
</AdaptationSet>
|
</AdaptationSet>
|
||||||
<AdaptationSet id="1" contentType="video" width="640" height="360" frameRate="30000/1001" subsegmentAlignment="true" par="16:9">
|
|
||||||
<Representation id="1" bandwidth="973483" codecs="avc1.64001e" mimeType="video/mp4" sar="1:1">
|
|
||||||
<BaseURL>bear-640x360-video.mp4</BaseURL>
|
|
||||||
<SegmentBase indexRange="870-937" timescale="30000">
|
|
||||||
<Initialization range="0-869"/>
|
|
||||||
</SegmentBase>
|
|
||||||
</Representation>
|
|
||||||
</AdaptationSet>
|
|
||||||
<AdaptationSet id="2" contentType="video" width="640" height="360" maxFrameRate="30000/22022" par="16:9">
|
|
||||||
<EssentialProperty schemeIdUri="http://dashif.org/guidelines/trickmode" value="1"/>
|
|
||||||
<Representation id="2" bandwidth="211545" codecs="avc1.64001e" mimeType="video/mp4" sar="1:1" frameRate="30000/22022" maxPlayoutRate="60" codingDependency="false">
|
|
||||||
<BaseURL>bear-640x360-video-trick_play_factor_2.mp4</BaseURL>
|
|
||||||
<SegmentBase indexRange="870-925" timescale="30000">
|
|
||||||
<Initialization range="0-869"/>
|
|
||||||
</SegmentBase>
|
|
||||||
</Representation>
|
|
||||||
<Representation id="3" bandwidth="211545" codecs="avc1.64001e" mimeType="video/mp4" sar="1:1" frameRate="30000/30030" maxPlayoutRate="30" codingDependency="false">
|
|
||||||
<BaseURL>bear-640x360-video-trick_play_factor_1.mp4</BaseURL>
|
|
||||||
<SegmentBase indexRange="870-937" timescale="30000">
|
|
||||||
<Initialization range="0-869"/>
|
|
||||||
</SegmentBase>
|
|
||||||
</Representation>
|
|
||||||
</AdaptationSet>
|
|
||||||
</Period>
|
</Period>
|
||||||
</MPD>
|
</MPD>
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
# https://developers.google.com/open-source/licenses/bsd
|
# https://developers.google.com/open-source/licenses/bsd
|
||||||
|
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND python3 generate_license_notice.py "${CMAKE_CURRENT_BINARY_DIR}"
|
COMMAND "${Python3_EXECUTABLE}" generate_license_notice.py "${CMAKE_CURRENT_BINARY_DIR}"
|
||||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||||
RESULT_VARIABLE STATUS)
|
RESULT_VARIABLE STATUS)
|
||||||
if(NOT STATUS EQUAL 0)
|
if(NOT STATUS EQUAL 0)
|
||||||
|
|
|
@ -31,3 +31,9 @@ add_custom_command(
|
||||||
${CMAKE_BINARY_DIR}/packager/)
|
${CMAKE_BINARY_DIR}/packager/)
|
||||||
|
|
||||||
add_custom_target(pssh_box_py ALL DEPENDS ${PSSH_BOX_OUTPUTS})
|
add_custom_target(pssh_box_py ALL DEPENDS ${PSSH_BOX_OUTPUTS})
|
||||||
|
|
||||||
|
# Always install the python tools.
|
||||||
|
install(PROGRAMS ${CMAKE_BINARY_DIR}/packager/pssh-box.py
|
||||||
|
DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||||
|
install(DIRECTORY ${CMAKE_BINARY_DIR}/packager/pssh-box-protos
|
||||||
|
DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
# https://developers.google.com/open-source/licenses/bsd
|
# https://developers.google.com/open-source/licenses/bsd
|
||||||
|
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND python3 generate_version_string.py
|
COMMAND "${Python3_EXECUTABLE}" generate_version_string.py
|
||||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||||
RESULT_VARIABLE STATUS
|
RESULT_VARIABLE STATUS
|
||||||
OUTPUT_VARIABLE PACKAGER_VERSION
|
OUTPUT_VARIABLE PACKAGER_VERSION
|
||||||
|
|
Loading…
Reference in New Issue