diff --git a/README-SAMPLES.md b/README-SAMPLES.md index 02a5bb85..22505ace4 100644 --- a/README-SAMPLES.md +++ b/README-SAMPLES.md @@ -373,9 +373,10 @@ This program is used to test reading the file ini-test. This program was added ``` Usage: iotest filein fileout1 fileout2 [remote [blocksize]] -fileouts are overwritten and should match filein exactly +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. +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) ``` diff --git a/README.md b/README.md index aa6b1361..f026775b 100644 --- a/README.md +++ b/README.md @@ -778,7 +778,7 @@ Environment Variables used by the test suite: |:-- |:-- |:-- |:-- | | EXIV2_BINDIR | **\/build/bin** | All Platforms | Location of built binary objects (exiv2.exe) | | EXIV2_PORT | **12762**
**12671**
**12760** | Cygwin
MinGW/msys2
Other Platforms | Test TCP/IP Port | -| EXIV2_HTTP | **http://0.0.0.0** | All Platforms | Test http server | +| EXIV2_HTTP | **http://localhost** | All Platforms | Test http server | | EXIV2_EXT | **.exe** | msvc
Cygwin
MinGW/msys2 | Extension used by executable binaries | | EXIV2_EXT | _**not set**_ | Linux
macOS
Unix| | | EXIV2_ECHO | _**not set**_ | All Platforms | For debugging Bash scripts | diff --git a/samples/iotest.cpp b/samples/iotest.cpp index 3b4f0c2a..f7847b3f 100644 --- a/samples/iotest.cpp +++ b/samples/iotest.cpp @@ -53,12 +53,13 @@ int main(int argc, char* const argv[]) try { if (argc < 4 || argc > 6 ) { std::cout << "Usage: " << argv[0] << " filein fileout1 fileout2 [remote [blocksize]]\n" - "fileouts are overwritten and should match filein exactly\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; + ; + return 1; } const char* f0 = argv[1]; // fileIn const char* f1 = argv[2]; // fileOut1 @@ -71,8 +72,8 @@ int main(int argc, char* const argv[]) // ensure bs is sane if (bs<1) bs=1 ; if (bs>1024*1024) bs=10000; - Exiv2::byte b[bs]; - + Exiv2::byte* b = new Exiv2::byte[bs]; + // copy fileIn from a remote location. FILE* f = fopen(f0,"wb"); if ( !f ) { @@ -94,12 +95,13 @@ int main(int argc, char* const argv[]) fwrite(b,1,1,f) ; } } + delete [] b; fclose(f); if ( !l ) { Error(Exiv2::kerFileOpenFailed, fr, "rb", strError()); } } - + FileIo fileIn(f0); if (fileIn.open() != 0) { throw Error(Exiv2::kerDataSourceOpenFailed, fileIn.path(), strError()); diff --git a/test/data/iotest.out b/test/data/iotest.out index d1b569ef..b2dd58cd 100644 --- a/test/data/iotest.out +++ b/test/data/iotest.out @@ -38,6 +38,6 @@ 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 -568 568 568 568 -568 568 568 568 +568 568 568 568 c245b8764e4cf1104374787e21b6ef63 c245b8764e4cf1104374787e21b6ef63 c245b8764e4cf1104374787e21b6ef63 c245b8764e4cf1104374787e21b6ef63 +568 568 568 568 c245b8764e4cf1104374787e21b6ef63 c245b8764e4cf1104374787e21b6ef63 c245b8764e4cf1104374787e21b6ef63 c245b8764e4cf1104374787e21b6ef63 +568 568 568 568 c245b8764e4cf1104374787e21b6ef63 c245b8764e4cf1104374787e21b6ef63 c245b8764e4cf1104374787e21b6ef63 c245b8764e4cf1104374787e21b6ef63 diff --git a/test/functions.source b/test/functions.source index 2798afa6..69f0bb83 100644 --- a/test/functions.source +++ b/test/functions.source @@ -443,8 +443,8 @@ startHttpServer() { 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://0.0.0.0; 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 url=$http:$port jobs=$(jobs | wc -l) python3 -m http.server $port & # start a background local HTTP server in the "real" test directory diff --git a/test/iotest.sh b/test/iotest.sh index 5e3e30af..8bc8a1d3 100755 --- a/test/iotest.sh +++ b/test/iotest.sh @@ -41,11 +41,11 @@ if [ "$EXIV2_PORT" != "None" -a "$EXIV2_HTTP" != "None" ]; then fi runTest iotest s0 s1 s2 $url/data/table.jpg 1 - echo $(stat $F s0 s1 s2 ../data/table.jpg) + echo $(stat $F s0 s1 s2 ../data/table.jpg) $(checkSum s0) $(checkSum s1) $(checkSum s2) $(checkSum ../data/table.jpg) runTest iotest s0 s1 s2 $url/data/table.jpg 10 - echo $(stat $F s0 s1 s2 ../data/table.jpg) + echo $(stat $F s0 s1 s2 ../data/table.jpg) $(checkSum s0) $(checkSum s1) $(checkSum s2) $(checkSum ../data/table.jpg) runTest iotest s0 s1 s2 $url/data/table.jpg 1000 - echo $(stat $F s0 s1 s2 ../data/table.jpg) + echo $(stat $F s0 s1 s2 ../data/table.jpg) $(checkSum s0) $(checkSum s1) $(checkSum s2) $(checkSum ../data/table.jpg) >&2 printf "*** HTTP tests end\n" ) | tr -d '\r' | sed 's/[ \t]+$//' > $results reportTest