Change EXIV2_HTTP default to http://localhost to keep msvc build happy. iotest.cpp modified to compile with msvc.

This commit is contained in:
clanmills 2020-05-15 09:15:24 +01:00
parent 7e55f5d5be
commit 32b9a2dfa1
6 changed files with 20 additions and 17 deletions

View File

@ -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)
```

View File

@ -778,7 +778,7 @@ Environment Variables used by the test suite:
|:-- |:-- |:-- |:-- |
| 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://0.0.0.0** | All Platforms | Test http server |
| 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 |

View File

@ -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());

View File

@ -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

View File

@ -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

View File

@ -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