From 076cdf6f1e6e9f139634fc981b4683a3fb1b2a4d Mon Sep 17 00:00:00 2001 From: LeoHsiao Date: Sun, 18 Oct 2020 19:31:27 +0800 Subject: [PATCH 1/2] Fix nls_test(): Check only part of the output --- test/data/nls-test.out | 8 -------- test/nls-test.sh | 6 +++--- tests/bash_tests/testcases.py | 24 +++++------------------- tests/bash_tests/utils.py | 2 +- 4 files changed, 9 insertions(+), 31 deletions(-) mode change 100755 => 100644 test/nls-test.sh diff --git a/test/data/nls-test.out b/test/data/nls-test.out index 9312e3fa..5ed3f526 100644 --- a/test/data/nls-test.out +++ b/test/data/nls-test.out @@ -1,10 +1,2 @@ exiv2: Une action doit être spécifié -exiv2: Au moins un fichier est nécessaire -Utilisation : exiv2 [ options ] [ action ] fichier ... - -Manipulation des métadonnées EXIF issues des images. exiv2: Se debe especificar una acción -exiv2: Se requiere un archivo al menos -Uso: exiv2 [ opciones ] [ acción ] archivo ... - -manipular los metadatos Exif de las imágenes. diff --git a/test/nls-test.sh b/test/nls-test.sh old mode 100755 new mode 100644 index 7948d30c..f434303b --- a/test/nls-test.sh +++ b/test/nls-test.sh @@ -35,11 +35,11 @@ source ./functions.source fi ## # test a couple of languages - for l in fr_FR es_ES; do ( + for l in fr_FR es_ES; do export LC_ALL=$l export $LANG=$l - runTest exiv2 - ) done + runTest exiv2 2>&1 | head -n 1 + done ) 3>&1 > $results 2>&1 diff --git a/tests/bash_tests/testcases.py b/tests/bash_tests/testcases.py index 2b14a172..e1ab86bb 100644 --- a/tests/bash_tests/testcases.py +++ b/tests/bash_tests/testcases.py @@ -866,24 +866,21 @@ set Exif.Photo.DateTimeDigitized 2020:05:26 07:31:42 def nls_test(self): # Test driver for exiv2.exe nls support nls = BT.Executer('exiv2 -vVg nls').stdout.split('\n')[1] - platform = BT.Executer('exiv2 -vVg platform').stdout.split('\n')[1] - if nls != 'enable_nls=1': print('Skipped. Because exiv2 is not built with nls.') return - if platform == 'platform=windows': - print('Skipped. Because nls_test cannot be run msvc builds.') + if BT.Config.system_name == 'Windows': + print('Skipped. Because nls_test is not supported on Windows.') return - if platform == 'platform=linux': + if BT.Config.system_name == 'Linux': LANG = 'LANGUAGE' else: LANG = 'LANG' share_dir = os.path.normpath(os.path.join(BT.Config.bin_dir, '..', 'share2')) os.makedirs(share_dir, exist_ok=True) - locale_dir = '/usr/local/share/locale' if os.path.isdir(locale_dir) and os.path.isdir(share_dir): BT.cp(locale_dir, share_dir) @@ -893,7 +890,8 @@ set Exif.Photo.DateTimeDigitized 2020:05:26 07:31:42 # The above part is checking the environment, and the following part is executing the actual test out = BT.Output() for language in ['fr_FR', 'es_ES']: - out += BT.Executer('exiv2', extra_env={'LC_ALL': language, LANG: language}, assert_returncode=[1]) + e = BT.Executer(cmd='exiv2', extra_env={'LC_ALL': language, LANG: language}, assert_returncode=[1], decode_output=False) + out += e.stdout.split(b'\n')[0].decode() BT.reportTest('nls-test', out) @@ -907,18 +905,6 @@ set Exif.Photo.DateTimeDigitized 2020:05:26 07:31:42 def png_test(self): # Test PNG support (-pS, -pc, -c, -pa) -# files="1343_empty.png 1343_comment.png 1343_exif.png" -# copyTestFiles $files -# runTest exiv2 -c 'comment in Reagan to hide non UTF-8 bytes' -# for file in $files ; do -# for i in 1 2 ; do -# runTest exiv2 -pS $file -# runTest exiv2 -pc $file -# runTest exiv2 -pa $file -# runTest exiv2 -c 'changed comment' $file -# done -# done - out = BT.Output() files = ['1343_empty.png' ,'1343_comment.png' diff --git a/tests/bash_tests/utils.py b/tests/bash_tests/utils.py index a7e319d9..baa6ee9a 100644 --- a/tests/bash_tests/utils.py +++ b/tests/bash_tests/utils.py @@ -25,7 +25,7 @@ class Config: bin_dir = os.path.join(exiv2_dir, 'build/bin') data_dir = os.path.join(exiv2_dir, 'test/data') tmp_dir = os.path.join(exiv2_dir, 'test/tmp') - system_name = platform.system() or 'Unknown' + system_name = platform.system() or 'Unknown' # It could be Windows, Linux, etc. exiv2_http = 'http://127.0.0.1' exiv2_port = 12760 From 27c7acccdcb3b0eab30690769bda4a6c99dba8b2 Mon Sep 17 00:00:00 2001 From: clanmills Date: Sun, 18 Oct 2020 12:53:57 +0100 Subject: [PATCH 2/2] Add +x (execute) attribute to shell scripts. --- test/exiv2-test.sh | 0 test/nls-test.sh | 0 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 test/exiv2-test.sh mode change 100644 => 100755 test/nls-test.sh diff --git a/test/exiv2-test.sh b/test/exiv2-test.sh old mode 100644 new mode 100755 diff --git a/test/nls-test.sh b/test/nls-test.sh old mode 100644 new mode 100755