Merge pull request #1174 from Exiv2/http_iotest_0.27

add http test to iotest.sh (0.27->master)
v0.27.3
Robin Mills 5 years ago committed by GitHub
commit 2e8606fa84
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,7 +1,7 @@
cmake_minimum_required( VERSION 3.3.2 )
project(exiv2 # use TWEAK to categorize the build
VERSION 0.27.3.1 # 0.27.3 = GM
VERSION 0.27.3.20 # 0.27.3 = GM
# 0.27.3.00 = GM Preview
# 0.27.3.09 = Not For Release
# 0.27.3.1 = RC1

@ -10,6 +10,8 @@ Exiv2 is a C++ library and a command line utility to read, write, delete and mod
### Sample Programs
The following programs are build and installed in /usr/local/bin.
| Name | Purpose | More information | Code |
|:--- |:--- |:--- |:-- |
| _**addmoddel**_ | Demonstrates Exiv2 library APIs to add, modify or delete metadata | [addmoddel](#addmoddel) | [addmoddel.cpp](samples/addmoddel.cpp) |
@ -24,6 +26,8 @@ Exiv2 is a C++ library and a command line utility to read, write, delete and mod
| _**iptcprint**_ | Demonstrates Exiv2 library APIs to print Iptc data | [iptceasy](#iptceasy) | [iptcprint.cpp](samples/iptcprint.cpp) |
| _**metacopy**_ | Demonstrates copying metadata from one image to another | [metacopy](#metacopy) | [metacopy.cpp](samples/metacopy.cpp) |
| _**mrwthumb**_ | Sample program to extract a Minolta thumbnail from the makernote | [mrwthumb](#mrwthumb) | [mrwthumb.cpp](samples/mrwthumb.cpp) |
| _**taglist**_ | Print a simple comma separated list of tags defined in Exiv2 | [taglist](#taglist) |
| _**xmpdump**_ | Sample program to dump the XMP packet of an image | [xmpdump](#xmpdump) |
| _**xmpparse**_ | Read an XMP packet from a file, parse it and print all (known) properties. | [xmpparse](#xmpparse) | [xmpparse.cpp](samples/xmpparse.cpp) |
| _**xmpprint**_ | Read an XMP from a file, parse it and print all (known) properties.. | [xmpprint](#xmpprint) | [xmpprint.cpp](samples/xmpprint.cpp) |
| _**xmpsample**_ | Demonstrates Exiv2 library high level XMP classes | [xmpsample](#xmpsample) | [xmpsample.cpp](samples/exmpsample.cpp) |
@ -34,7 +38,7 @@ Exiv2 is a C++ library and a command line utility to read, write, delete and mod
### Test Programs
As Exiv2 is open source, we publish all our materials. Some of the following programs are actively used in our test harness. Some of the following programs were written during the development of features and their on-going use may be limited, or even obsolete. In general these programs are published as source and Team Exiv2 will not provide support to users.
As Exiv2 is open source, we publish all our materials. The following programs are actively used in our test harness. Some were written during feature development of features and their on-going use may be limited, or even obsolete. In general these programs are published as source and Team Exiv2 will not provide support to users.
| Name | Kind | More information |
|:--- |:--- |:--- |
@ -52,13 +56,11 @@ As Exiv2 is open source, we publish all our materials. Some of the following pr
| _**prevtest**_ | Test access to preview images | [prevtest](#prevtest) |
| _**remotetest**_ | Tester application for testing remote i/o. | [remotetest](#remotetest) |
| _**stringto-test**_ | Test conversions from string to long, float and Rational types. | [stringto-test](#stringto-test) |
| _**taglist**_ | Print a simple comma separated list of tags defined in Exiv2 | [taglist](#taglist) |
| _**tiff-test**_ | Simple TIFF write test | [tiff-test](#tiff-test) |
| _**werror-test**_ | Simple tests for the wide-string error class WError | [werror-test](#werror-test) |
| _**write-test**_ | ExifData write unit tests | [write-test](#write-test) |
| _**write2-test**_ | ExifData write unit tests for Exif data created from scratch | [write2-test](#write2-test) |
| _**xmpdump**_ | Sample program to dump the XMP packet of an image | [xmpdump](#xmpdump) |
| _**xmpparser-test**_ | Read an XMP packet from a file, parse and re-serialize it. | [xmpparser-test](#xmpparser-test) |
| _**xmpparser-test**_ | Read an XMP packet from a file, parse and re-serialize it. | [xmpparser-test](#xmpparser-test)|
[Sample](#TOC1) Programs [Test](#TOC2) Programs
@ -106,16 +108,16 @@ This is a simple program to demonstrate dumping _**Exif**_ metadata in common fo
#### exifprint
```
Usage: exifprint [ file | --version | --version-test ]
Usage: exifprint [ path | --version | --version-test ]
```
| Arguments | Description |
|:-- |:--- |
| file | Path to image |
| path | Path to image |
| --version | Print version information from build |
| --version-test | Tests Exiv2 VERSION API |
This program demonstrates how to print _**Exif**_ metadata in an image. This program is also discussed in the platform ReadMe.txt file included in a build bundle. The option **--version** was added enable the user to build a test application which dumps the build information. The option **--version-test** was added to test the macro EXIV2\_TEST\_VERSION() in **include/exiv2/version.hpp**.
This program demonstrates how to print _**Exif**_ metadata in an image. This program is also discussed in the platform ReadMe.txt file included in a build bundle. The option **--version** was added to enable the user to build a test application which dumps the build information. The option **--version-test** was added to test the macro EXIV2\_TEST\_VERSION() in **include/exiv2/version.hpp**.
There is one other unique feature of this program. It is the only test/sample program which can use the EXV\_UNICODE\_PATH build feature of Exiv2 on Windows.
@ -204,13 +206,16 @@ If the path is a directory, geotag will read all the files in the directory. It
| Arguments | Description |
|:-- |:--- |
| -ascii | Output in ascii (not UTF8). Prints `deg` instead of °. |
| -help | print usage statement |
| -version | prints data and time of compiling geotag.cpp |
| -dst | Apply 1 hour adjustment for daylight saving time. |
| -dryrun | Read arguments and print report. Does not modify images. |
| -ascii | Output in ascii (not UTF8). Prints `deg` instead of °. |
| -verbose | Report progress. |
| -adjust value | Add/subtract time from image data. |
| -tz value | Specify time zone. For example PST = -8:00 |
| -delta value | Correction between Image DataTime and GPS time. |
| path+ | One or more directories, image paths or gpx paths. Directories are searched for gpx and images |
I use this program frequently. I have a little Canon camera which I take when I run. My Samsung Galaxy Watch uploads my runs to Strava and I download the GPX. If I'm in another time-zone and have forgotten to change the time setting in the camera, I use `-adjust` to alter the images. The GPX time is always correct, however the camera is normally off by seconds or minutes. This option enables you to correct for inaccuracy in the setting of the camera time.
@ -372,8 +377,12 @@ This program is used to test reading the file ini-test. This program was added
#### iotest
```
Usage: iotest filein fileout1 fileout2
fileouts are overwritten and should match filein exactly
Usage: iotest filein fileout1 fileout2 [remote [blocksize]]
copy filein to fileout1 and copy filein to fileout2
fileout1 and fileout2 are overwritten and should match filein exactly
You may optionally provide the URL of a remote file to be copied to filein
If you use `remote`, you may optionally provide a blocksize for the copy buffer (default 10k)
```
Test programs for BasicIo functions.
@ -643,4 +652,4 @@ Read an XMP packet from a file, parse and re-serialize it.
Robin Mills<br>
robin@clanmills.com<br>
Revised: 2019-06-20
Revised: 2020-05-17

@ -1,9 +1,25 @@
| Travis | AppVeyor | GitLab| Codecov| Repology|
|:-------------:|:-------------:|:-----:|:------:|:-------:|
| [![Build Status](https://travis-ci.org/Exiv2/exiv2.svg?branch=0.27-maintenance)](https://travis-ci.org/Exiv2/exiv2) | [![Build status](https://ci.appveyor.com/api/projects/status/d6vxf2n0cp3v88al/branch/0.27-maintenance?svg=true)](https://ci.appveyor.com/project/piponazo/exiv2-wutfp/branch/0.27-maintenance) | [![pipeline status](https://gitlab.com/D4N/exiv2/badges/0.27-maintenance/pipeline.svg)](https://gitlab.com/D4N/exiv2/commits/0.27-maintenance) | [![codecov](https://codecov.io/gh/Exiv2/exiv2/branch/0.27-maintenance/graph/badge.svg)](https://codecov.io/gh/Exiv2/exiv2) | [![Packaging status](https://repology.org/badge/tiny-repos/exiv2.svg)](https://repology.org/metapackage/exiv2/versions) |
<div id="1">
# Welcome to Exiv2
Exiv2 is a C++ library and a command-line utility to read,
write, delete and modify Exif, IPTC, XMP and ICC image metadata.
| Exiv2 Resource | Location |
|:---------- |:------ |
| Releases and Documentation<br>Prereleases:<br>Project Resources<br>License (GPLv2)<br>CMake Downloads | [https://exiv2.org](https://exiv2.org)<br>[https://pre-release.exiv2.org](https://pre-release.exiv2.org)<br>[https://github.com/Exiv2/exiv2](https://github.com/Exiv2/exiv2)<br>[COPYING](COPYING)<br>[https://cmake.org/download/](https://cmake.org/download/) |
| README.md<br>README-CONAN.md<br>README-SAMPLES.md | User Manual. _This document_<br>Conan User Manual _[click here](README-CONAN.md)_<br>Sample Code Manual. _[click here](README-SAMPLES.md)_ |
The file ReadMe.txt in a build bundle describes how to install the library on the platform. ReadMe.txt also documents how to compile and link code on the platform.
<div id="TOC">
### TABLE OF CONTENTS
![Exiv2](exiv2.png)
1. [Welcome to Exiv2](#1)
2. [Building, Installing, Using and Uninstalling Exiv2](#2)
@ -41,25 +57,6 @@
5. [Microsoft Visual C++](#5-5)
6. [Unix](#5-6)
<div id="1">
# Welcome to Exiv2
![Exiv2](exiv2.png)
Exiv2 is a C++ library and a command line utility to read,
write, delete and modify Exif, IPTC, XMP and ICC image metadata.
| Exiv2 Resource | Location |
|:------ |:---- |
| Releases and Documentation | [https://exiv2.org](https://exiv2.org) |
| Prereleases: | [https://pre-release.exiv2.org](https://pre-release.exiv2.org) |
| Project Resources | [https://github.com/Exiv2/exiv2](https://github.com/Exiv2/exiv2) |
| License (GPLv2) | [COPYING](COPYING) |
| CMake Downloads | [https://cmake.org/download/](https://cmake.org/download/) |
The file ReadMe.txt in a build bundle describes how to install the library on the platform. ReadMe.txt also documents how to compile and link code on the platform.
[TOC](#TOC)
<div id="2">
@ -72,12 +69,12 @@ You need [CMake](https://cmake.org/download/) to configure the Exiv2 project and
### 2.1 Build, Install, Use Exiv2 on a UNIX-like system
```bash
cd ~/gnu/github/exiv2 # location of the project code
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build .
make tests
sudo make install
$ cd ~/gnu/github/exiv2 # location of the project code
$ mkdir build && cd build
$ cmake .. -DCMAKE_BUILD_TYPE=Release
$ cmake --build .
$ make tests
$ sudo make install
```
This will install the library into the "standard locations". The library will be installed in `/usr/local/lib`, executables (including the exiv2 command-line program) in `/usr/local/bin/` and header files in `/usr/local/include/exiv2`
@ -104,9 +101,8 @@ $ export DYLD_LIBRARY_PATH="/usr/local/lib:$DYLD_LIBRARY_PATH" # macOS
### 2.2 Build and Install Exiv2 with Visual Studio
We recommend that you use conan to download the Exiv2 external dependencies on Windows (On Linux/OSX you can use or install system packages).
Apart from handling the dependencies, to configure and compile the project is pretty similar to the UNIX like systems.
See [README-CONAN](README-CONAN.md) for more information
We recommend that you use conan to download the Exiv2 external dependencies on Windows. On other platforms (maxOS, Ubuntu and others), you should use the platform package manger. These are discussed: [Platform Notes](#5) The options to configure and compile the project using Visual Studio are similar to UNIX like systems.
See [README-CONAN](README-CONAN.md) for more information about Conan.
[TOC](#TOC)
<div id="2-3">
@ -131,9 +127,10 @@ option( EXIV2_ENABLE_PNG "Build with png support (requires libz)" ON
577 rmills@rmillsmm:~/gnu/github/exiv2/exiv2 $
```
Options are defined on the CMake command line:
Options are defined on the CMake command-line:
```bash
$ cmake -DBUILD_SHARED_LIBS=On -DEXIV2_ENABLE_NLS=OFF
$ cmake -DBUILD_SHARED_LIBS=On -DEXIV2_ENABLE_NLS=Off
```
[TOC](#TOC)
@ -150,9 +147,8 @@ The following Exiv2 features require external libraries:
| Natural language system | gettext | OFF | -DEXIV2\_ENABLE\_NLS=On | [http://www.gnu.org/software/gettext/](http://www.gnu.org/software/gettext/) |
On UNIX systems, you may install the dependencies using the distribution's package management system. Install the
development package of a dependency to install the header files and libraries required to build Exiv2. In the file
`ci/install_dependencies.sh` you can check to the list of packages we install on different Linux distributions. This
file is used to setup some CI images in which we try out the Exiv2 compilation.
development package of a dependency to install the header files and libraries required to build Exiv2. The script
`ci/install_dependencies.sh` is used to setup CI images on which we build and test Exiv2 on many platforms when we modify code. You may find that helpful in setting up your platform dependencies.
Natural language system is discussed in more detail here: [Localisation](#2-8)
@ -169,7 +165,7 @@ See [README-CONAN](README-CONAN.md) for more information.
There are detailed platform notes about compiling and linking in `releasenotes/{platform}/ReadMe.txt`
where `platform: { CYGWIN | macOS | Linux | MinGW | msvc }`
where `platform: { CYGWIN | Darwin | Linux | MinGW | msvc | Unix }`
In general you need to do the following:
@ -202,27 +198,24 @@ You can build samples/exifprint.cpp as follows:
$ cd <exiv2dir>
$ mkdir exifprint
$ cd exifprint
$ *** EDIT CMakeLists.txt ***
$ cat CMakeLists.txt
$ cat - > CMakeLists.txt <<EOF
cmake_minimum_required(VERSION 3.8)
project(exifprint VERSION 0.0.1 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 98)
set(CMAKE_CXX_EXTENSIONS OFF)
find_package(exiv2 REQUIRED CONFIG NAMES exiv2) # search ${CMAKE_INSTALL_PREFIX}/lib/cmake/exiv2/
add_executable(exifprint ../samples/exifprint.cpp) # compile this
target_link_libraries(exifprint exiv2lib) # link exiv2lib
EOF
$ cmake . # generate the makefile
$ make # build the code
$ ./exifprint # test your executable
Usage: ./exifprint [ file | --version || --version-test ]
Usage: bin/exifprint [ path | --version | --version-test ]
$
```
This [repository](https://github.com/piponazo/exiv2Consumer) shows an example of how to consume Exiv2 with CMake.
[TOC](#TOC)
<div id="2-7">
@ -255,7 +248,7 @@ g++ -std=c++98 myprogram.cpp -o myprogram $(pkg-config exiv2 --libs --cflags)
Localisation is supported on a UNIX-like platform: Linux, macOS, Cygwin and MinGW/msys2. Localisation is not supported for Visual Studio builds.
To build localisation support, use the CMake option `-DEXIV2_ENABLE_NLS=ON`. You must install the `gettext` package with your package manager or from source. The `gettext` package is available from [http://www.gnu.org/software/gettext/](http://www.gnu.org/software/gettext/) and includes the library `libintl` and utilities to build localisation files. If CMake produces error messages which mention libintl or gettext, you should verify that the package `gettext` has been correctly built and installed.
To build localisation support, use the CMake option `-DEXIV2_ENABLE_NLS=On`. You must install the `gettext` package with your package manager or from source. The `gettext` package is available from [http://www.gnu.org/software/gettext/](http://www.gnu.org/software/gettext/) and includes the library `libintl` and utilities to build localisation files. If CMake produces error messages which mention libintl or gettext, you should verify that the package `gettext` has been correctly built and installed.
You must install the build to test localisation. This ensures that the localisation message files can be found at run-time. You cannot test localisation in the directory `build\bin`.
@ -350,7 +343,7 @@ To build documentation, use the CMake option **`-DEXIV2_BUILD_DOC=On`**.
Additionally, you will require an additional build step to actually build the documentation.
```bash
$ cmake ..options.. -DEXIV2_BUILD_DOC=ON
$ cmake ..options.. -DEXIV2_BUILD_DOC=On
$ make doc
```
@ -365,7 +358,7 @@ To build the documentation, you must install the following products:
### 2.10 Building Exiv2 Packages
To enable the building of Exiv2 packages, use the CMake option `-DEXIV2_TEAM_PACKAGING=ON`.
To enable the building of Exiv2 packages, use the CMake option `-DEXIV2_TEAM_PACKAGING=On`.
You should not build Exiv2 Packages. This feature is intended for use by Team Exiv2 to create Platform and Source Packages on the buildserver.
@ -443,19 +436,19 @@ Exiv2 respects the symbol `NDEBUG` which is set only for Release builds. There a
#endif
```
Those blocks of code are not compiled unless you define `EXIV2_DEBUG_MESSAGES` by yourself. They are provided for additional debugging information. For example, if you are interested in additional output from webpimage.cpp, you can update your build as follows:
Those blocks of code are not compiled unless you define `EXIV2_DEBUG_MESSAGES`. They are provided for additional debugging information. For example, if you are interested in additional output from webpimage.cpp, you can update your build as follows:
```bash
$ cd <exiv2dir>
$ touch src/webpimage.cpp
$ make CXXFLAGS=-DEXIV2_DEBUG_MESSAGESDEBUG
$ make CXXFLAGS=-DEXIV2_DEBUG_MESSAGES
$ bin/exiv2 ...
-- or --
$ sudo make install
$ exiv2 ...
```
If you are debugging library code, it is recommended that you use the exiv2 command-line as your test harness as Team Exiv2 is very familiar with this tool and able to give support.
If you are debugging library code, it is recommended that you use the exiv2 command-line program as your test harness as Team Exiv2 is very familiar with this tool and able to give support.
[TOC](#TOC)
@ -479,7 +472,7 @@ I personally use CLion which has excellent integration with CMake. It will auto
5) cmake --build . options **`--config Release|Debug`** and **`--target install`**
Visual Studio and Xcode can build debug or release builds without using the option **`-DCMAKE_BUILD_TYPE`** because the generated project files can build multiple types. The option **`--config Debug`** can be specified on the command-line to specify the build type. Alternatively, if you prefer to build in the IDE, the UI provides options to select the configuration and target.
Visual Studio and Xcode can build debug or release builds without using the option **`-DCMAKE_BUILD_TYPE`** because the generated project files can build multiple types. The option **`--config Debug`** can be specified on the cmake command-line to specify the build type. Alternatively, if you prefer to build in the IDE, the UI provides options to select the configuration and target.
With the Unix Makefile generator, the targets can be listed:
@ -579,7 +572,7 @@ As discussed in the section on Thread Safety, Exiv2 classes for Exif and IPTC me
Adobe's XMPsdk is generally thread-safe, however it has to be initialized and terminated before and after starting any threads to access XMP metadata. The Exiv2 library will initialize this if necessary, however it does not terminate the XMPsdk.
The Exiv2 command-line and the sample applications call the following at the outset:
The exiv2 command-line program and sample applications call the following at the outset:
```
Exiv2::XmpParser::initialize();
@ -630,11 +623,11 @@ $ make
Note, you may wish to choose to build with optional features and/or build static libraries. To do this, request appropriately on the mingw64-cmake command:
```bash
$ mingw64-cmake .. -DEXIV2_TEAM_EXTRA_WARNINGS=ON \
-DEXIV2_ENABLE_VIDEO=ON \
-DEXIV2_ENABLE_WEBREADY=ON \
-DEXIV2_ENABLE_WIN_UNICODE=ON \
-DBUILD_SHARED_LIBS=OFF
$ mingw64-cmake .. -DEXIV2_TEAM_EXTRA_WARNINGS=On \
-DEXIV2_ENABLE_VIDEO=On \
-DEXIV2_ENABLE_WEBREADY=On \
-DEXIV2_ENABLE_WIN_UNICODE=On \
-DBUILD_SHARED_LIBS=Off
```
The options available for cross-compiling are the same as provided for all builds. See: [Build Options](#2-3)
@ -671,9 +664,9 @@ If you have not installed wine, Fedora will offer to install it for you.
####6 Running the test suite
On a default wine installation, you are in the MSDOS/cmd prompt. You cannot execute the exiv2 test suite in this environment as you require python3 and MSYS/bash to run the suite.
On a default wine installation, you are in the MSDOS/cmd.exe prompt. You cannot execute the exiv2 test suite in this environment as you require python3 and MSYS/bash to run the suite.
You should mount the your Fedora exiv2/ directory on a Windows machine on which you have installed MSYS2. You will need python3 and make.
You should mount the your Fedora exiv2/ directory on a Windows machine on which you have installed MinGW/msys2. You will need python3 and make.
My build machines is a MacMini with VMs for Windows, Fedora and other platforms. On Fedora, I build in a Mac directory which is shared to all VMs.
@ -685,7 +678,7 @@ My build machines is a MacMini with VMs for Windows, Fedora and other platforms.
[rmills@rmillsmm-fedora 0.27-maintenance]$
```
On MSYS2, I can directly access the share:
On MinGW/msys2, I can directly access the share:
```bash
$ cd //Mac/Home/gnu/github/exiv2/0.27/maintenance/build_mingw_fedora
@ -760,7 +753,7 @@ For new bug reports and feature requests, please open an issue in Github.
## 4 Running the test suite
There are different kinds of tests:
#### Different kinds of tests:
| Description | Language | Location | Command<br>_(in build or test directory)_ | CMake Option to Build |
|:-- |:-- |:-- |:-- |:-- |
@ -770,19 +763,26 @@ There are different kinds of tests:
| Unit tests | C++ | \<exiv2dir\>/unitTests | $ make unit_test | -DEXIV2\_BUILD\_UNIT\_TESTS=On |
| Version test | C++ | \<exiv2dir\>/src/version.cpp | $ make version_test | Always in library |
**Caution Visual Studio Users using cmd.exe**<br>_You may use `make` to to execute tests in the test directory. To execute tests from the build directory, use `cmake`._ This is discussed in detail below: [Running tests on Visual Studio builds](#4-2)
_**Caution Visual Studio Users using cmd.exe**_<br>_You may use MinGW/msys2 `make` to to execute tests in the test directory. To execute tests from the build directory, use `cmake`. This is discussed in detail below: [Running tests on Visual Studio builds](#4-2)_
#### Environment Variables used by the test suite:
Environment Variables used by the test suite:
If you build the code in the directory \<exiv2dir\>build, tests will run using the default values of Environment Variables.
| Variable | Default | Platforms | Purpose |
|:-- |:-- |:-- |:-- |
| EXIV2_BINDIR | **\<exiv2dir\>/build/bin** | All Platforms | Locatation of built binary object (exiv2.exe) |
| EXIV2_EXT | **.exe** | msvc<br>Cygwin<br>Msys<br>MinGW | Extension used by executable binaries |
| EXIV2_BINDIR | **\<exiv2dir\>/build/bin** | All Platforms | Location of built binary objects (exiv2.exe) |
| EXIV2_PORT | **12762**<br>**12671**<br>**12760** | Cygwin<br>MinGW/msys2<br>Other Platforms | Test TCP/IP Port |
| EXIV2_HTTP | **http://localhost** | All Platforms | Test http server |
| EXIV2_EXT | **.exe** | msvc<br>Cygwin<br>MinGW/msys2 | Extension used by executable binaries |
| EXIV2_EXT | _**not set**_ | Linux<br>macOS<br>Unix| |
| EXIV2_ECHO | _**not set**_ | All Platforms | For debugging Bash scripts |
| VALGRIND | _**not set**_ | All Platforms | For debugging Bash scripts |
| VERBOSE | _**not set**_ | All Platforms | Causes make to report its actions |
The Variable EXIV2\_PORT or EXIV2\_HTTP can be set to None to skip http tests. The http server is started with the command `python3 -m http.server $port`. On Windows, you will need to run this manually _**once**_ to authorise the firewall to permit python to use the port.
[TOC](#TOC)
<div id="4-1">
### 4.1 Running tests on a UNIX-like system
@ -790,15 +790,16 @@ Environment Variables used by the test suite:
You can run tests directly from the build:
```bash
$ cmake .. -G "Unix Makefiles"
$ cmake .. -G "Unix Makefiles" -DEXIV2_BUILD_UNIT_TESTS=On
$ make
...
... lots of output ...
$ make tests
... lots of output ...
Summary report
$
```
You can run individual tests in the `test` directory using the environment variable EXIV2\_BINDIR to specify the location of the build artifacts. For Windows builds (msvc, Cygwin, Msys, MinGW), set EXIV2_EXT=.exe
You can run individual tests in the `test` directory. **Caution:** If you build in a directory other than \<exiv2dir\>/build, you must set EXIV2\_BINDIR to run tests from the `test` directory.
```bash
$ cd <exiv2dir>/build
@ -813,6 +814,7 @@ test_run (tiff_test.test_tiff_test_program.TestTiffTestProg) ... ok
----------------------------------------------------------------------
Ran 176 tests in 9.526s
OK (skipped=6)
$
```
[TOC](#TOC)
@ -824,23 +826,21 @@ To run the bash scripts you will need to install MinGW/msys2 which provides you
##### Running tests from MinGW/msys2 bash
Use the bash interpreter for MinGW/msys2 to run the test suite. It's essential to have a DOS Python3 interpreter on your path called `python3.exe` The variables EXIV2\_BINDIR and EXIV2\_EXT enable the test suite to locate the MSVC build artifacts.
Use the bash interpreter for MinGW/msys2 to run the test suite. It's essential to have a DOS Python3 interpreter on your path called `python3.exe`
```bash
$ cd <exiv2dir>/build
$ cd ../test
$ PATH="/c/Python37:$PATH"
$ export EXIV2_EXT=.exe
$ export EXIV2_BINDIR=${PWD}/../build/bin
```
**Caution:** _The python3 interpreter must be for DOS and called python3.exe. I copied the python.exe program:_
```
..>copy c:\Python37\python.exe c:\Python37\python3.exe
$ cp /cygpath/c/Python37/python.exe /cygpath/c/Python37/python3.exe
```
Once you have modified the PATH and exported EXIV2\_BINDIR and EXIV2\_EXT, you can execute the test suite as described for UNIX-like systems:
You can execute the test suite as described for UNIX-like systems:
```bash
$ cd <exiv2dir>/test
@ -848,6 +848,9 @@ $ make tests
$ make python_tests
$ ./icc-test.sh
```
**Caution:** If you build in a directory other than \<exiv2dir\>/build, you must set EXIV2\_BINDIR to run tests from the `test` directory.
##### Running tests from cmd.exe
You can build with Visual Studio using Conan. The is described in detail in [README-CONAN.md](README-CONAN.md)
@ -864,25 +867,23 @@ c:\...\exiv2\build>cmake --build . --config Release
c:\...\exiv2\build>
```
**Caution:** _You will need a DOS python3 interpreter which must be called python3.exe. I copied the python.exe program:_
**Caution:** To run the python tests, _You will need a DOS python3 interpreter which must be called python3.exe. I copied the python.exe program:_ You may have to modify the PATH to ensure that the DOS python3 is used. You may have to modify the PATH to access MinGW/msys2 tools such as bash and make. Be careful to ensure the DOS python3.exe is found before the MinGW/msys2 python3.
```
c:\...\exiv2\build>copy c:\Python37\python.exe c:\Python37\python3.exe
c:\...\exiv2\build>set "PATH=c:\Python37;c:\Python37\Scripts;c:\msys64\usr\bin;%PATH%"
```
You must set the environment strings EXIV2\_BINDIR, EXIV2\_EXT and modify PATH. You will need a DOS Python3 interpreter on your path, and you'll need the bash interpreter. By careful to ensure the DOS python3.exe is found before the MingW/msys2 python3.
You can now run the tests from cmd.exe:
```
c:\...\exiv2\build>cd bin
c:\...\exiv2\build\bin>set EXIV2_BINDIR=%CD%
c:\...\exiv2\build\bin>set EXIV2_EXT=.exe
c:\...\exiv2\build\bin>set "PATH=c:\Python37;c:\Python37\Scripts;c:\msys64\usr\bin;%PATH%"
c:\...\exiv2\build>cmake --build . --config Release --target tests
```
Move to the test directory and use make (which is in c:\msys64\usr\bin) to drive the test procedures. You cannot run the tests in the build directory because there is no Makefile in the build directory.
You may prefer to run tests in the directory using MinGW/msys2 make.
```
c:\...\exiv2\build\bin>cd ..\..\test
c:\...\exiv2\build\>cd ..\test
c:\...\exiv2\test>make bash_tests
...
c:\...\exiv2\test>make python_tests # or unit_test or version_test
@ -891,53 +892,24 @@ c:\...\exiv2\test>make tests # run all the tests
...
```
I use the following batch file _cmd64.bat_ to set up a special path for cmd.exe. This ensures that I can jump instantly to the test directory with all the correct tools (DOS python, DOS cmake, msys/bash etc) on the PATH.
```
@echo off
setlocal
set "P="
set "P=%P%C:\Python37\;C:\Python37\Scripts;" # DOS Python3
set "P=%P%c:\Program Files\cmake\bin;" # DOS cmake
set "P=%P%c:\msys64\usr\bin;" # msys2 make, bash etc
set "P=%P%c:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin;"
set "P=%P%c:\Windows\System32;" # windows
set "P=%P%%USERPROFILE%\com;" # my home-made magic
set "PATH=%P%"
set "EXIV2_EXT=.exe"
color 1e
cmd /S /K cd "%USERPROFILE%\gnu\github\exiv2\0.27-maintenance\"
color
endlocal
```
When you have the PATH constructed is this way, you can use the cmake command to run tests directly from the build directory as follows:
```
c:\...\exiv2\test>cd ..\build
c:\...\exiv2\build>cmake --build . --config Release --target tests
```
If you wish to use an environment variables, use env:
```
c:\...\exiv2\build>env VERBOSE=1 cmake --build . --config Release --target tests
```
When you are in the test directory, msys/make provides the following _(more convenient)_ syntax:
When you are in the test directory, MinGW/msys2 make supports the following _(more convenient)_ syntax:
```
c:\...\exiv2\test>make tests VERBOSE=1
```
[TOC](#TOC)
<div id="4-3">
### 4.3 Unit tests
The code for the unit tests is in `<exiv2dir>/unitTests`. To include unit tests in the build, use the *cmake* option `-DEXIV2_BUILD_UNIT_TESTS=ON`.
The code for the unit tests is in `<exiv2dir>/unitTests`. To include unit tests in the build, use the *cmake* option `-DEXIV2_BUILD_UNIT_TESTS=On`.
There is a discussion on the web about installing GTest: [https://github.com/Exiv2/exiv2/issues/575](https://github.com/Exiv2/exiv2/issues/575)
@ -1085,7 +1057,7 @@ $ make
#### MinGW and Regex
The exiv2 command line program provides an option **`--grep`** to filter output. The implementation requires the header file **`<regex.h>`** and supporting library to be available during the build. When not available, the option **`--grep`** degrades to a substring match. Because there are several versions of **`<regex.h>`** available on the MinGW platform, detection of regex is always disabled on this platform and uses substring match. The following command reveals if regex is included in your build:
The exiv2 command-line program provides an option **`--grep`** to filter output. The implementation requires the header file **`<regex.h>`** and supporting library to be available during the build. When not available, the option **`--grep`** degrades to a substring match. Because there are several versions of **`<regex.h>`** available on the MinGW platform, detection of regex is always disabled on this platform and uses substring match. The following command reveals if regex is included in your build:
```bash
$ exiv2 -vVg regex
@ -1148,15 +1120,13 @@ setlocal
set "P="
set "P=%P%C:\Python37\;C:\Python37\Scripts;" # DOS Python3
set "P=%P%c:\Program Files\cmake\bin;" # DOS cmake
set "P=%P%c:\msys64\usr\bin;" # msys2 make, bash etc
set "P=%P%c:\msys64\usr\bin;" # MinGW/msys2 make, bash etc
set "P=%P%c:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin;"
set "P=%P%c:\Windows\System32;" # windows
set "P=%P%%USERPROFILE%\com;" # my home-made magic
set "PATH=%P%"
set "EXIV2_EXT=.exe"
color 1e
cmd /S /K cd "%USERPROFILE%\gnu\github\exiv2\0.27-maintenance\"
color
endlocal
```
@ -1259,4 +1229,5 @@ $ sudo pkg install developer/gcc-7
[TOC](#TOC)
Written by Robin Mills<br>robin@clanmills.com<br>Updated: 2020-05-12
Written by Robin Mills<br>robin@clanmills.com<br>Updated: 2020-05-17

@ -4,14 +4,10 @@
Exif.Photo.UserComment
File: exifcomment.cpp
Author(s): Andreas Huggel (ahu) <ahuggel@gmx.net>
History : 10-May-04, ahu: created
16-Jan-05, ahu: updated using CommentValue and operator trickery
*/
// *****************************************************************************
// included header files
#include <exiv2/exiv2.hpp>
#include <iostream>
#include <cassert>
@ -36,7 +32,7 @@ try {
Exiv2 uses a CommentValue for Exif user comments. The format of the
comment string includes an optional charset specification at the beginning:
[charset=["]Ascii|Jis|Unicode|Undefined["] ]comment
[charset=[Ascii|Jis|Unicode|Undefined]] comment
Undefined is used as a default if the comment doesn't start with a charset
definition.
@ -45,9 +41,9 @@ try {
the file.
*/
exifData["Exif.Photo.UserComment"]
= "charset=\"Unicode\" An Unicode Exif comment added with Exiv2";
= "charset=Unicode A Unicode Exif comment added with Exiv2";
exifData["Exif.Photo.UserComment"]
= "charset=\"Undefined\" An undefined Exif comment added with Exiv2";
= "charset=Undefined An undefined Exif comment added with Exiv2";
exifData["Exif.Photo.UserComment"]
= "Another undefined Exif comment added with Exiv2";
exifData["Exif.Photo.UserComment"]

@ -36,7 +36,7 @@ try {
const _tchar* file = argv[1];
if (argc != 2) {
std::_tcout << _t("Usage: ") << prog << _t(" [ file | --version || --version-test ]") << std::endl;
std::_tcout << _t("Usage: ") << prog << _t(" [ path | --version | --version-test ]") << std::endl;
return 1;
}

@ -31,6 +31,7 @@
#include <cstdio> // for EOF
#include <cstring>
#include <iostream>
#include <stdio.h>
using Exiv2::byte;
using Exiv2::BasicIo;
@ -50,81 +51,122 @@ int main(int argc, char* const argv[])
::atexit(Exiv2::XmpParser::terminate);
try {
if (argc != 4) {
std::cout << "Usage: " << argv[0] << " filein fileout1 fileout2\n";
std::cout << "fileouts are overwritten and should match filein exactly\n";
return 1;
}
FileIo fileIn(argv[1]);
if (fileIn.open() != 0) {
throw Error(Exiv2::kerDataSourceOpenFailed, fileIn.path(), strError());
}
if (argc < 4 || argc > 6 ) {
std::cout << "Usage: " << argv[0] << " filein fileout1 fileout2 [remote [blocksize]]\n"
"copy filein to fileout1 and copy filein to fileout2\n"
"fileout1 and fileout2 are overwritten and should match filein exactly\n"
"\n"
"You may optionally provide the URL of a remote file to be copied to filein\n"
"If you use `remote`, you may optionally provide a blocksize for the copy buffer (default 10k)\n"
;
return 1;
}
const char* f0 = argv[1]; // fileIn
const char* f1 = argv[2]; // fileOut1
const char* f2 = argv[3]; // fileOut2
const char* fr = argv[4]; // remote file
const char* ba = argv[5]; // block argument
if ( argc >= 5 ) {
int blocksize = argc==6 ? atoi(ba) : 10000;
// ensure blocksize is sane
if (blocksize>1024*1024) blocksize=10000;
Exiv2::byte* bytes = blocksize>0 ? new Exiv2::byte[blocksize]: NULL;
// copy fileIn from a remote location.
BasicIo::AutoPtr io = Exiv2::ImageFactory::createIo(fr);
if ( io->open() != 0 ) {
Error(Exiv2::kerFileOpenFailed, io->path(), "rb", strError());
}
FileIo output(f0);
if ( !output.open("wb") ) {
Error(Exiv2::kerFileOpenFailed, output.path() , "w+b", strError());
}
size_t l = 0;
if ( bytes ) {
int r ;
while ( (r=io->read(bytes,blocksize)) > 0 ) {
l += r;
output.write(bytes,r) ;
}
} else {
// read/write byte-wise (#1029)
while ( l++ < io->size() ) {
output.putb(io->getb()) ;
}
}
if ( bytes ) delete [] bytes;
output.close();
}
FileIo fileOut1(argv[2]);
if (fileOut1.open("w+b") != 0) {
throw Error(Exiv2::kerFileOpenFailed, argv[2], "w+b", strError());
}
FileIo fileIn(f0);
if (fileIn.open() != 0) {
throw Error(Exiv2::kerDataSourceOpenFailed, fileIn.path(), strError());
}
MemIo memIo1;
FileIo fileOut1(f1);
if (fileOut1.open("w+b") != 0) {
throw Error(Exiv2::kerFileOpenFailed, f1, "w+b", strError());
}
// Copy to output file through memIo
memIo1.write(fileIn);
memIo1.seek(0, BasicIo::beg);
fileOut1.write(memIo1);
MemIo memIo1;
// Make sure they are all the same size
if(fileIn.size() != memIo1.size() || memIo1.size() != fileOut1.size()) {
std::cerr << argv[0] <<
": Sizes do not match\n";
return 1;
}
// Copy to output file through memIo
memIo1.write(fileIn);
memIo1.seek(0, BasicIo::beg);
fileOut1.write(memIo1);
// Read writereadseek test on MemIo
MemIo memIo2;
int rc = WriteReadSeek(memIo2);
if (rc != 0) return rc;
// Make sure they are all the same size
if(fileIn.size() != memIo1.size() || memIo1.size() != fileOut1.size()) {
std::cerr << argv[0] <<
": Sizes do not match\n";
return 1;
}
// Read writereadseek test on FileIo
// Create or overwrite the file, then close it
FileIo fileTest("iotest.txt");
if (fileTest.open("w+b") != 0) {
throw Error(Exiv2::kerFileOpenFailed, "iotest.txt", "w+b", strError());
}
// Read writereadseek test on MemIo
MemIo memIo2;
int rc = WriteReadSeek(memIo2);
if (rc != 0) return rc;
fileTest.close();
rc = WriteReadSeek(fileTest);
if (rc != 0) return rc;
// Read writereadseek test on FileIo
// Create or overwrite the file, then close it
FileIo fileTest("iotest.txt");
if (fileTest.open("w+b") != 0) {
throw Error(Exiv2::kerFileOpenFailed, "iotest.txt", "w+b", strError());
}
// Another test of reading and writing
fileOut1.seek(0, BasicIo::beg);
memIo2.seek(0, BasicIo::beg);
FileIo fileOut2(argv[3]);
if (fileOut2.open("w+b") != 0) {
throw Error(Exiv2::kerFileOpenFailed, argv[3], "w+b", strError());
}
fileTest.close();
rc = WriteReadSeek(fileTest);
if (rc != 0) return rc;
long readCount = 0;
byte buf[32];
while ((readCount=fileOut1.read(buf, sizeof(buf)))) {
if (memIo2.write(buf, readCount) != readCount) {
std::cerr << argv[0] <<
": MemIo bad write 2\n";
return 13;
// Another test of reading and writing
fileOut1.seek(0, BasicIo::beg);
memIo2.seek(0, BasicIo::beg);
FileIo fileOut2(f2);
if (fileOut2.open("w+b") != 0) {
throw Error(Exiv2::kerFileOpenFailed, f2, "w+b", strError());
}
if (fileOut2.write(buf, readCount) != readCount) {
std::cerr << argv[0] <<
": FileIo bad write 2\n";
return 14;
long readCount = 0;
byte buf[32];
while ((readCount=fileOut1.read(buf, sizeof(buf)))) {
if (memIo2.write(buf, readCount) != readCount) {
std::cerr << argv[0] <<
": MemIo bad write 2\n";
return 13;
}
if (fileOut2.write(buf, readCount) != readCount) {
std::cerr << argv[0] <<
": FileIo bad write 2\n";
return 14;
}
}
}
return 0;
}
catch (Exiv2::AnyError& e) {
std::cerr << "Caught Exiv2 exception '" << e << "'\n";
return 20;
}
return 0;
} catch (Exiv2::AnyError& e) {
std::cerr << "Caught Exiv2 exception '" << e << "'\n";
return 20;
}
}

@ -30,6 +30,7 @@
#include "error.hpp"
#include "http.hpp"
#include "properties.hpp"
#include "image_int.hpp"
// + standard includes
#include <string>
@ -2097,9 +2098,9 @@ namespace Exiv2 {
request["page" ] = hostInfo_.Path;
if (hostInfo_.Port != "") request["port"] = hostInfo_.Port;
request["verb"] = "HEAD";
long serverCode = (long)http(request, response, errors);
int serverCode = http(request, response, errors);
if (serverCode < 0 || serverCode >= 400 || errors.compare("") != 0) {
throw Error(kerTiffDirectoryTooLarge, "Server", serverCode);
throw Error(kerFileOpenFailed, "http",Exiv2::Internal::stringFormat("%d",serverCode), hostInfo_.Path);
}
Exiv2::Dictionary_i lengthIter = response.find("Content-Length");
@ -2121,9 +2122,9 @@ namespace Exiv2 {
request["header"] = ss.str();
}
long serverCode = (long)http(request, responseDic, errors);
int serverCode = http(request, responseDic, errors);
if (serverCode < 0 || serverCode >= 400 || errors.compare("") != 0) {
throw Error(kerTiffDirectoryTooLarge, "Server", serverCode);
throw Error(kerFileOpenFailed, "http",Exiv2::Internal::stringFormat("%d",serverCode), hostInfo_.Path);
}
response = responseDic["body"];
}
@ -2175,7 +2176,7 @@ namespace Exiv2 {
int serverCode = http(request, response, errors);
if (serverCode < 0 || serverCode >= 400 || errors.compare("") != 0) {
throw Error(kerTiffDirectoryTooLarge, "Server", serverCode);
throw Error(kerFileOpenFailed, "http",Exiv2::Internal::stringFormat("%d",serverCode), hostInfo_.Path);
}
}
HttpIo::HttpIo(const std::string& url, size_t blockSize)
@ -2304,11 +2305,11 @@ namespace Exiv2 {
if(res != CURLE_OK) { // error happends
throw Error(kerErrorMessage, curl_easy_strerror(res));
}
// get return code
long returnCode;
curl_easy_getinfo (curl_, CURLINFO_RESPONSE_CODE, &returnCode); // get code
if (returnCode >= 400 || returnCode < 0) {
throw Error(kerTiffDirectoryTooLarge, "Server", returnCode);
// get status
int serverCode;
curl_easy_getinfo (curl_, CURLINFO_RESPONSE_CODE, &serverCode); // get code
if (serverCode >= 400 || serverCode < 0) {
throw Error(kerFileOpenFailed, "http",Exiv2::Internal::stringFormat("%d",serverCode),path_);
}
// get length
double temp;
@ -2342,10 +2343,10 @@ namespace Exiv2 {
if(res != CURLE_OK) {
throw Error(kerErrorMessage, curl_easy_strerror(res));
} else {
long serverCode;
int serverCode;
curl_easy_getinfo (curl_, CURLINFO_RESPONSE_CODE, &serverCode); // get code
if (serverCode >= 400 || serverCode < 0) {
throw Error(kerTiffDirectoryTooLarge, "Server", serverCode);
throw Error(kerFileOpenFailed, "http",Exiv2::Internal::stringFormat("%d",serverCode),path_);
}
}
}
@ -2394,10 +2395,10 @@ namespace Exiv2 {
if(res != CURLE_OK) {
throw Error(kerErrorMessage, curl_easy_strerror(res));
} else {
long serverCode;
int serverCode;
curl_easy_getinfo (curl_, CURLINFO_RESPONSE_CODE, &serverCode);
if (serverCode >= 400 || serverCode < 0) {
throw Error(kerTiffDirectoryTooLarge, "Server", serverCode);
throw Error(kerFileOpenFailed, "http",Exiv2::Internal::stringFormat("%d",serverCode),path_);
}
}
}

@ -18,15 +18,6 @@
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
*/
/*
* http.cpp
*/
#ifdef _MSC_VER
#include <winsock2.h>
#pragma comment(lib, "ws2_32.lib")
#endif
// included header files
#include "config.h"
@ -41,6 +32,10 @@
#include <sys/stat.h>
#include <string.h>
#if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW__)
#include <winsock2.h>
#endif
#define SLEEP 1000
#define SNOOZE 0
@ -52,9 +47,8 @@
// platform specific code
#if defined(WIN32) || defined(_MSC_VER) || defined(__MINGW__)
#include <string.h>
#include <windows.h>
#include <io.h>
#ifndef __MINGW__
#if !defined(__MINGW__) && !defined(__CYGWIN__)
#define snprintf sprintf_s
#define write _write
#define read _read
@ -210,7 +204,7 @@ int Exiv2::http(Exiv2::Dictionary& request,Exiv2::Dictionary& response,std::stri
////////////////////////////////////
// Windows specific code
#ifdef WIN32
#if defined(WIN32) || defined(_MSC_VER) || defined(__MINGW__) || defined(__CYGWIN__)
WSADATA wsaData;
WSAStartup(MAKEWORD(2,2), &wsaData);
#endif

@ -0,0 +1,43 @@
Exif.Image.DateTime Ascii 21 2004-07-13T21:23:44Z
Iptc.Application2.City String 7 Seattle
Exif.Image.DateTime Ascii 21 2004-07-13T21:23:44Z
Iptc.Application2.City String 7 Seattle
Exif.Image.DateTime Ascii 21 2004-07-13T21:23:44Z
Iptc.Application2.City String 7 Seattle
Exif.Image.DateTime Ascii 21 2004-07-13T21:23:44Z
Iptc.Application2.City String 7 Seattle
Exif.Image.DateTime Ascii 20 2012:04:07 16:11:27
Exif.Photo.DateTimeOriginal Ascii 20 2004:06:21 23:37:53
Exif.Photo.DateTimeDigitized Ascii 20 2004:06:21 23:37:53
Iptc.Application2.City String 19 Straits of Magellan
Xmp.photoshop.City XmpText 19 Straits of Magellan
Exif.Image.DateTime Ascii 20 2012:04:07 16:11:27
Exif.Photo.DateTimeOriginal Ascii 20 2004:06:21 23:37:53
Exif.Photo.DateTimeDigitized Ascii 20 2004:06:21 23:37:53
Iptc.Application2.City String 19 Straits of Magellan
Xmp.photoshop.City XmpText 19 Straits of Magellan
Exif.Image.DateTime Ascii 20 2012:04:07 16:11:27
Exif.Photo.DateTimeOriginal Ascii 20 2004:06:21 23:37:53
Exif.Photo.DateTimeDigitized Ascii 20 2004:06:21 23:37:53
Iptc.Application2.City String 19 Straits of Magellan
Xmp.photoshop.City XmpText 19 Straits of Magellan
Exif.Image.DateTime Ascii 20 2012:04:07 16:11:27
Exif.Photo.DateTimeOriginal Ascii 20 2004:06:21 23:37:53
Exif.Photo.DateTimeDigitized Ascii 20 2004:06:21 23:37:53
Iptc.Application2.City String 19 Straits of Magellan
Xmp.photoshop.City XmpText 19 Straits of Magellan
Exif.Image.DateTime Ascii 20 2015:02:13 20:46:51
Exif.Photo.DateTimeOriginal Ascii 20 2015:02:13 13:51:35
Exif.Photo.DateTimeDigitized Ascii 20 2015:02:13 13:51:35
Exif.Image.DateTime Ascii 20 2015:02:13 20:46:51
Exif.Photo.DateTimeOriginal Ascii 20 2015:02:13 13:51:35
Exif.Photo.DateTimeDigitized Ascii 20 2015:02:13 13:51:35
Exif.Image.DateTime Ascii 20 2015:02:13 20:46:51
Exif.Photo.DateTimeOriginal Ascii 20 2015:02:13 13:51:35
Exif.Photo.DateTimeDigitized Ascii 20 2015:02:13 13:51:35
Exif.Image.DateTime Ascii 20 2015:02:13 20:46:51
Exif.Photo.DateTimeOriginal Ascii 20 2015:02:13 13:51:35
Exif.Photo.DateTimeDigitized Ascii 20 2015:02:13 13:51:35
568 568 568 568 c245b8764e4cf1104374787e21b6ef63 c245b8764e4cf1104374787e21b6ef63 c245b8764e4cf1104374787e21b6ef63 c245b8764e4cf1104374787e21b6ef63
568 568 568 568 c245b8764e4cf1104374787e21b6ef63 c245b8764e4cf1104374787e21b6ef63 c245b8764e4cf1104374787e21b6ef63 c245b8764e4cf1104374787e21b6ef63
568 568 568 568 c245b8764e4cf1104374787e21b6ef63 c245b8764e4cf1104374787e21b6ef63 c245b8764e4cf1104374787e21b6ef63 c245b8764e4cf1104374787e21b6ef63

@ -227,12 +227,12 @@ diffCheck()
if [ -z "$errors" ]; then let -a errors=0; fi
#run diff and check results
if [ "$PLATFORM" == SunOS ]; then
bdiff $diffargs "$test" "$good"
elif [ "$PLATFORM" == FreeBSD -o "$PLATFORM" == NetBSD ]; then
diff $diffargs "$test" "$good"
if [ $PLATFORM == SunOS ]; then
bdiff $diffargs "$test" "$good"
elif [ $PLATFORM == FreeBSD -o $PLATFORM == NetBSD ]; then
diff $diffargs "$test" "$good"
else
diff --binary $diffargs "$test" "$good"
diff --binary $diffargs "$test" "$good"
fi
if [ $? -ne 0 ]; then
errors=$(expr $errors + 1)
@ -426,16 +426,49 @@ copyVideoFiles ()
# print checksum for one file
checkSum()
{
# cygwin checksum: http://esrg.sourceforge.net/utils_win_up/md5sum/
# macos - built/installed coreutils 8.25 http://ftp.gnu.org/gnu/coreutils/
platform=$(uname)
if [ "$platform" == 'NetBSD' -o "$platform" == 'FreeBSD' ]; then
md5 -q $1
if [ "$PLATFORM" == 'NetBSD' -o "$PLATFORM" == 'FreeBSD' -o "$PLATFORM" == 'Darwin' ]; then
md5 -q $1
else
md5sum $1 | cut -f 1 -d' '
md5sum $1 | cut -d' ' -f 1
fi
}
##
# startHttpServer - power up the python web server
startHttpServer() {
cd "${testdir}/.." # testdir is the tmp output directory
# PLATFORM = the scripting host (eg mingw)
# host = the build host (eg windows for msvc)
if [ $PLATFORM == 'cygwin' -o $PLATFORM == 'mingw' ]; then
host=$(runTest exiv2 -vVg platform | tail -1 | cut -d= -f 2) # windows
fi
if [ "$host" != windows ]; then host="$PLATFORM" ; fi
if [ "$host" == "cygwin" ]; then dport=12762
elif [ "$host" == "mingw" ]; then dport=12761
else dport=12760
fi
if [ ! -z $EXIV2_PORT ]; then port=$EXIV2_PORT ; else port=$dport ; fi
if [ ! -z $EXIV2_HTTP ]; then http=$EXIV2_HTTP ; else http=http://localhost; fi
exiv2_url=$http:$port
python3 -m http.server $port & # start a background local HTTP server in the "real" test directory
sleep 2 # wait for it to init or die!
exiv2_httpServer=$!
# ask the server to reply
echo $exiv2_url status = $(python3 -c "import urllib.request;print(urllib.request.urlopen('$exiv2_url/').status)")
}
##
# closeHttpServer - power down the python web server
closeHttpServer() {
if [ ! -z $exiv2_httpServer ]; then
echo kill exiv2_httpServer $exiv2_httpServer
kill $exiv2_httpServer # kill the server
fi
}
##
# prepare temp files and other variables
prepareTest()
@ -533,6 +566,7 @@ prepareTest()
exit 42
fi
done
}
prepareTest

@ -1,5 +1,5 @@
#!/usr/bin/env bash
# Test driver for image file i/o
# Test driver for file i/o
source ./functions.source
@ -8,8 +8,9 @@ source ./functions.source
errors=0
test_files="table.jpg smiley2.jpg ext.dat"
echo
printf "Io tests"
for i in $test_files; do ioTest $i; done
printf "file io tests"
copyTestFiles $test_files
for i in $test_files; do runTest iotest $i s1 s2; done
printf "\n---------------------------------------------------------\n"
if [ $errors -eq 0 ]; then
@ -19,5 +20,41 @@ source ./functions.source
fi
)
sniff() {
# Format spec for stat
F='-c%s'
if [ $PLATFORM == 'Darwin' -o $PLATFORM == 'NetBSD' -o $PLATFORM == 'FreeBSD' ]; then
F='-f%z'
fi
echo $(stat $F s0 s1 s2 ../data/table.jpg) $(checkSum s0) $(checkSum s1) $(checkSum s2) $(checkSum ../data/table.jpg)
}
# Test http I/O
if [ "$EXIV2_PORT" != "None" -a "$EXIV2_HTTP" != "None" ]; then
startHttpServer
if [ ! -z $exiv2_httpServer ]; then
( cd "${testdir}"
>&2 printf "*** HTTP tests begin\n"
cd "$testdir"
test_files="table.jpg Reagan.tiff exiv2-bug922a.jpg"
for i in $test_files; do
runTest iotest s0 s1 s2 $exiv2_url/data/$i
for t in s0 s1 s2 $exiv2_url/data/$i; do
runTest exiv2 -g City -g DateTime $t
done
done
runTest iotest s0 s1 s2 $exiv2_url/data/table.jpg 0 ; sniff
runTest iotest s0 s1 s2 $exiv2_url/data/table.jpg 10 ; sniff
runTest iotest s0 s1 s2 $exiv2_url/data/table.jpg 1000 ; sniff
>&2 printf "*** HTTP tests end\n"
) | tr -d '\r' | sed 's/[ \t]+$//' > $results
reportTest
fi
closeHttpServer
fi
# That's all Folks!
##
Loading…
Cancel
Save