mirror of https://github.com/xiph/flac
Add checks for decoding from and encoding to UTF-8 filenames
This commit is contained in:
parent
1bec35e337
commit
61649d09aa
|
@ -18,6 +18,10 @@ if(NOT UNIX)
|
|||
add_test(NAME flac_help
|
||||
COMMAND $<TARGET_FILE:flacapp> --help
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
|
||||
add_test(NAME flac_utf8_test COMMAND $<TARGET_FILE:flacapp> -t
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/flac-to-flac-metadata-test-files/שלום.flac"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/flac-to-flac-metadata-test-files/Prøve.flac"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/flac-to-flac-metadata-test-files/🤔.flac")
|
||||
add_test(NAME metaflac_help
|
||||
COMMAND $<TARGET_FILE:metaflac> --help
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
|
||||
|
@ -36,7 +40,7 @@ endif()
|
|||
|
||||
configure_file(common.sh.in common.sh @ONLY)
|
||||
|
||||
set(ALL_TESTS libFLAC grabbag flac metaflac replaygain seeking streams compression)
|
||||
set(ALL_TESTS libFLAC grabbag)
|
||||
|
||||
add_test(NAME libFLAC
|
||||
COMMAND ${BUSYBOX_EXE} ${BUSYBOX_CMD} "${CMAKE_CURRENT_SOURCE_DIR}/test_libFLAC.sh"
|
||||
|
@ -51,26 +55,44 @@ file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/cuesheets")
|
|||
add_test(NAME grabbag
|
||||
COMMAND ${BUSYBOX_EXE} ${BUSYBOX_CMD} "${CMAKE_CURRENT_SOURCE_DIR}/test_grabbag.sh"
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
add_test(NAME flac
|
||||
COMMAND ${BUSYBOX_EXE} ${BUSYBOX_CMD} "${CMAKE_CURRENT_SOURCE_DIR}/test_flac.sh"
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/metaflac-test-files")
|
||||
add_test(NAME metaflac
|
||||
COMMAND ${BUSYBOX_EXE} ${BUSYBOX_CMD} "${CMAKE_CURRENT_SOURCE_DIR}/test_metaflac.sh"
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
add_test(NAME replaygain
|
||||
COMMAND ${BUSYBOX_EXE} ${BUSYBOX_CMD} "${CMAKE_CURRENT_SOURCE_DIR}/test_replaygain.sh"
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
add_test(NAME seeking
|
||||
COMMAND ${BUSYBOX_EXE} ${BUSYBOX_CMD} "${CMAKE_CURRENT_SOURCE_DIR}/test_seeking.sh"
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
add_test(NAME streams
|
||||
COMMAND ${BUSYBOX_EXE} ${BUSYBOX_CMD} "${CMAKE_CURRENT_SOURCE_DIR}/test_streams.sh"
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
# increase this if standard 1500 seconds are not enough
|
||||
# set_tests_properties(streams PROPERTIES TIMEOUT 1500)
|
||||
add_test(NAME compression
|
||||
COMMAND ${BUSYBOX_EXE} ${BUSYBOX_CMD} "${CMAKE_CURRENT_SOURCE_DIR}/test_compression.sh"
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
if(BUILD_PROGRAMS)
|
||||
add_test(NAME flac
|
||||
COMMAND ${BUSYBOX_EXE} ${BUSYBOX_CMD} "${CMAKE_CURRENT_SOURCE_DIR}/test_flac.sh"
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
# UTF-8 must be tested separately on Windows because busybox-w32 doesn't support UTF-8
|
||||
if(BUSYBOX_EXE)
|
||||
add_test(NAME flac_utf8_test COMMAND $<TARGET_FILE:flacapp> -t
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/flac-to-flac-metadata-test-files/שלום.flac"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/flac-to-flac-metadata-test-files/Prøve.flac"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/flac-to-flac-metadata-test-files/🤔.flac")
|
||||
list(APPEND ALL_TESTS flac_utf8_test)
|
||||
endif()
|
||||
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/metaflac-test-files")
|
||||
add_test(NAME metaflac
|
||||
COMMAND ${BUSYBOX_EXE} ${BUSYBOX_CMD} "${CMAKE_CURRENT_SOURCE_DIR}/test_metaflac.sh"
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
add_test(NAME replaygain
|
||||
COMMAND ${BUSYBOX_EXE} ${BUSYBOX_CMD} "${CMAKE_CURRENT_SOURCE_DIR}/test_replaygain.sh"
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
add_test(NAME seeking
|
||||
COMMAND ${BUSYBOX_EXE} ${BUSYBOX_CMD} "${CMAKE_CURRENT_SOURCE_DIR}/test_seeking.sh"
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
add_test(NAME streams
|
||||
COMMAND ${BUSYBOX_EXE} ${BUSYBOX_CMD} "${CMAKE_CURRENT_SOURCE_DIR}/test_streams.sh"
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
# increase this if standard 1500 seconds are not enough
|
||||
# set_tests_properties(streams PROPERTIES TIMEOUT 1500)
|
||||
add_test(NAME compression
|
||||
COMMAND ${BUSYBOX_EXE} ${BUSYBOX_CMD} "${CMAKE_CURRENT_SOURCE_DIR}/test_compression.sh"
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
list(APPEND ALL_TESTS flac metaflac replaygain seeking streams compression)
|
||||
endif()
|
||||
|
||||
set_property(TEST ${ALL_TESTS} APPEND PROPERTY ENVIRONMENT ECHO_C=\\c)
|
||||
|
||||
set_property(TEST ${ALL_TESTS} APPEND PROPERTY ENVIRONMENT FLAC__TEST_LEVEL=1)
|
||||
if(BUSYBOX_EXE)
|
||||
set_property(TEST ${ALL_TESTS} APPEND PROPERTY ENVIRONMENT ECHO_N=-n)
|
||||
set_property(TEST ${ALL_TESTS} APPEND PROPERTY ENVIRONMENT WIN32BUSYBOX=yes)
|
||||
else()
|
||||
set_property(TEST ${ALL_TESTS} APPEND PROPERTY ENVIRONMENT ECHO_C=\\c)
|
||||
endif()
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1290,6 +1290,36 @@ if [ "$FLAC__TEST_LEVEL" -gt 1 ] ; then
|
|||
test_total_samples_overflow 68719476737 0
|
||||
fi
|
||||
|
||||
############################################################################
|
||||
# test handling of UTF-8 filenames
|
||||
############################################################################
|
||||
|
||||
|
||||
test_utf8_handling ()
|
||||
{
|
||||
echo $ECHO_N "Test decoding from $1... " $ECHO_C
|
||||
run_flac -d $testdatadir/$1 -o out.wav
|
||||
if [ -f out.wav ] ; then
|
||||
echo "OK"
|
||||
else
|
||||
die "Decoding failed"
|
||||
fi
|
||||
echo $ECHO_N "Test encoding to $1... " $ECHO_C
|
||||
run_flac out.wav -o $1
|
||||
if [ -f $1 ] ; then
|
||||
echo "OK"
|
||||
else
|
||||
die "Encoding failed"
|
||||
fi
|
||||
rm $1 out.wav
|
||||
}
|
||||
|
||||
if [ "$WIN32BUSYBOX" != "yes" ]; then
|
||||
test_utf8_handling שלום.flac
|
||||
test_utf8_handling 🤔.flac
|
||||
test_utf8_handling Prøve.flac
|
||||
fi
|
||||
|
||||
rm -f out.flac out.meta out1.meta
|
||||
|
||||
#@@@ when metaflac handles ogg flac, duplicate flac2flac tests here
|
||||
|
|
Loading…
Reference in New Issue