Changed CI build default -DEXIV2_ENABLE_BMFF=On. Fixed suite to run with/without bmff. -pS and -pR same for bmff.

This commit is contained in:
clanmills 2021-03-03 10:40:08 +00:00
parent 0e1412ad44
commit 55d2201892
6 changed files with 90 additions and 32 deletions

View File

@ -6,7 +6,7 @@ git:
env:
global:
- COMMON_CMAKE_OPTIONS="-DEXIV2_ENABLE_WEBREADY=ON -DEXIV2_ENABLE_CURL=ON -DEXIV2_BUILD_UNIT_TESTS=ON -DEXIV2_TEAM_WARNINGS_AS_ERRORS=ON -DCMAKE_INSTALL_PREFIX=install"
- COMMON_CMAKE_OPTIONS="-DEXIV2_ENABLE_WEBREADY=ON -DEXIV2_ENABLE_CURL=ON -DEXIV2_BUILD_UNIT_TESTS=ON -DEXIV2_ENABLE_BMFF=ON -DEXIV2_TEAM_WARNINGS_AS_ERRORS=ON -DCMAKE_INSTALL_PREFIX=install"
matrix:
include:

View File

@ -74,7 +74,7 @@ build_script:
- cmd: conan --version
- cmd: conan install .. -o webready=%WEBREADY% --build missing
- cmd: echo %CMAKE_GENERATOR%
- cmd: cmake -G "%CMAKE_GENERATOR%" -DEXIV2_TEAM_WARNINGS_AS_ERRORS=%WARNINGS_AS_ERRORS% -DCMAKE_BUILD_TYPE=Release -DEXIV2_ENABLE_NLS=OFF -DEXIV2_ENABLE_PNG=ON -DEXIV2_ENABLE_WEBREADY=%WEBREADY% -DEXIV2_BUILD_UNIT_TESTS=%UNIT_TESTS% -DCMAKE_INSTALL_PREFIX=install ..
- cmd: cmake -G "%CMAKE_GENERATOR%" -DEXIV2_TEAM_WARNINGS_AS_ERRORS=%WARNINGS_AS_ERRORS% -DCMAKE_BUILD_TYPE=Release -DEXIV2_ENABLE_NLS=OFF -DEXIV2_ENABLE_PNG=ON -DEXIV2_ENABLE_BMFF=ON -DEXIV2_ENABLE_WEBREADY=%WEBREADY% -DEXIV2_BUILD_UNIT_TESTS=%UNIT_TESTS% -DCMAKE_INSTALL_PREFIX=install ..
- cmd: cmake --build . --config Release
- cmd: cmake --build . --config Release --target install
- cmd: cd bin

View File

@ -117,7 +117,7 @@ if __name__ == '__main__':
type=str,
nargs='?',
default="-DEXIV2_TEAM_EXTRA_WARNINGS=ON -DEXIV2_ENABLE_VIDEO=ON "
"-DEXIV2_ENABLE_WEBREADY=ON -DEXIV2_BUILD_UNIT_TESTS=ON "
"-DEXIV2_ENABLE_WEBREADY=ON -DEXIV2_BUILD_UNIT_TESTS=ON -DEXIV2_ENABLE_BMFF=ON "
"-DBUILD_WITH_CCACHE=ON -DEXIV2_ENABLE_CURL=ON"
)

View File

@ -46,7 +46,6 @@ add_library( exiv2lib
../include/exiv2/rwlock.hpp
../include/exiv2/slice.hpp
basicio.cpp ../include/exiv2/basicio.hpp
bmffimage.cpp ../include/exiv2/bmffimage.hpp
bmpimage.cpp ../include/exiv2/bmpimage.hpp
convert.cpp ../include/exiv2/convert.hpp
cr2image.cpp ../include/exiv2/cr2image.hpp
@ -119,6 +118,12 @@ if( EXIV2_ENABLE_VIDEO )
)
endif()
if( EXIV2_ENABLE_BMFF )
target_sources(exiv2lib PRIVATE
bmffimage.cpp ../include/exiv2/bmffimage.hpp
)
endif()
# Other library target properties
# ---------------------------------------------------------

View File

@ -188,15 +188,14 @@ namespace Exiv2
long BmffImage::boxHandler(std::ostream& out /* = std::cout*/ , Exiv2::PrintStructureOption option /* = kpsNone */,int depth /* =0 */)
{
long result = (long)io_->size();
long result = (long)io_->size();
long address = (long)io_->tell();
if (visits_.find(address) != visits_.end() || visits_.size() > visits_max_) {
throw Error(kerCorruptedMetadata);
}
visits_.insert(address);
bool bTrace = (option == kpsBasic && depth == 0) || option == kpsRecursive ;
Exiv2::PrintStructureOption recursion = option == kpsBasic ? kpsNone : option ;
bool bTrace = option == kpsBasic || option == kpsRecursive ;
#ifdef EXIV2_DEBUG_MESSAGES
bTrace = true ;
#endif
@ -266,7 +265,7 @@ namespace Exiv2
io_->seek(skip, BasicIo::cur);
while (n-- > 0) {
io_->seek(boxHandler(out,recursion,depth + 1), BasicIo::beg);
io_->seek(boxHandler(out,option,depth + 1), BasicIo::beg);
}
} break;
@ -300,7 +299,7 @@ namespace Exiv2
}
io_->seek(skip, BasicIo::cur);
while ((long)io_->tell() < (long)(address + box.length)) {
io_->seek(boxHandler(out,recursion,depth + 1), BasicIo::beg);
io_->seek(boxHandler(out,option,depth + 1), BasicIo::beg);
}
// post-process meta box to recover Exif and XMP
if (box.type == TAG_meta) {
@ -423,7 +422,7 @@ namespace Exiv2
}
if (name == "cano") {
while ((long)io_->tell() < (long)(address + box.length)) {
io_->seek(boxHandler(out,recursion,depth + 1), BasicIo::beg);
io_->seek(boxHandler(out,option,depth + 1), BasicIo::beg);
}
} else if ( name == "xmp" ) {
parseXmp(box.length,io_->tell());

View File

@ -2,16 +2,61 @@
import system_tests
from system_tests import BT
import os
import shlex
import shutil
import subprocess
def chop(blob):
lines=[]
line=''
for c in blob.decode('utf-8'):
if c == '\n':
lines=lines+[line]
line=''
elif c != '\r':
line=line+str(c)
if len(line) != 0:
lines=lines+line
return lines
def runTest(cmd):
try:
p = subprocess.Popen( shlex.split(cmd), stdout=subprocess.PIPE,shell=False)
out,err = p.communicate()
if p.returncode != 0:
print('%s returncode = %d' % (cmd,p.returncode) )
out=chop(out)
except:
error('%s died' % cmd )
return out
class pr_1475_hif_Sony(metaclass=system_tests.CaseMeta):
url = "https://github.com/Exiv2/exiv2/pull/1475"
bSkip=False
filename = "$data_path/Sony.HIF"
commands = ["$exiv2 -g Image.Make -g Date -g Xm -g Expo -g Flash $filename"
,"$exiv2 -pR $filename"
,"$exiv2 -pX $filename"
,"$exiv2 -pC $filename"
]
stdout = ["""Exif.Image.Make Ascii 5 SONY
# test needs enable_bmff=1
exiv2_exe=os.path.join(BT.Config.bin_dir, "exiv2")
bSkip = bSkip or runTest(exiv2_exe + " -vVg enable_bmff")[-1] != "enable_bmff=1"
if bSkip:
commands=[]
retval=[]
stdin=[]
stderr=[]
stdout=[]
print("*** test skipped ***")
else:
filename = "$data_path/Sony.HIF"
commands = ["$exiv2 -g Image.Make -g Date -g Xm -g Expo -g Flash $filename"
,"$exiv2 -pS $filename"
,"$exiv2 -pX $filename"
,"$exiv2 -pC $filename"
]
retval = [ 0 ] * len(commands)
stderr = [ "" ] * len(commands)
stdin = [ "" ] * len(commands)
stdout = ["""Exif.Image.Make Ascii 5 SONY
Exif.Image.DateTime Ascii 20 2021:02:18 19:55:41
Exif.Photo.ExposureTime Rational 1 1/1000 s
Exif.Photo.ExposureProgram Short 1 Manual
@ -111,21 +156,33 @@ Exiv2::BmffImage::boxHandler: mdat 4088->147464
<?xpacket end="w"?>""",""
]
retval = [ 0 ] * len(commands)
stderr = [ "" ] * len(commands)
<?xpacket end="w"?>""",""]
class pr_1475_hif_Canon(metaclass=system_tests.CaseMeta):
url = "https://github.com/Exiv2/exiv2/pull/1475"
bSkip=False
filename = "$data_path/Canon.HIF"
commands = ["$exiv2 -g Image.Make -g Date -g Xm -g Expo -g Flash $filename"
,"$exiv2 -pR $filename"
,"$exiv2 -pX $filename"
,"$exiv2 -pC $filename"
]
stdout = ["""Exif.Image.Make Ascii 6 Canon
# test needs enable_bmff=1
exiv2_exe=os.path.join(BT.Config.bin_dir, "exiv2")
bSkip = bSkip or runTest(exiv2_exe + " -vVg enable_bmff")[-1] != "enable_bmff=1"
if bSkip:
commands=[]
retval=[]
stdin=[]
stderr=[]
stdin=[]
print("*** skipped. test requires both enable_bmff and debug***")
else:
filename = "$data_path/Canon.HIF"
commands = ["$exiv2 -g Image.Make -g Date -g Xm -g Expo -g Flash $filename"
,"$exiv2 -pS $filename"
,"$exiv2 -pX $filename"
,"$exiv2 -pC $filename"
]
retval = [ 0 ] * len(commands)
stderr = [ "" ] * len(commands)
stdin = [ "" ] * len(commands)
stdout = ["""Exif.Image.Make Ascii 6 Canon
Exif.Image.DateTime Ascii 20 2021:02:18 19:54:47
Exif.Photo.ExposureTime Rational 1 1/1000 s
Exif.Photo.ExposureProgram Short 1 Manual
@ -219,8 +276,5 @@ Exiv2::BmffImage::boxHandler: mdat 1195->1252197
<?xpacket end="w"?>""",""
]
retval = [ 0 ] * len(commands)
stderr = [ "" ] * len(commands)
<?xpacket end="w"?>""",""]