Test: initial version build-test.py to analyse output from exiv2 -v -V
This commit is contained in:
+38
-24
@@ -53,6 +53,14 @@ namespace Exiv2 {
|
||||
return EXIV2_MAKE_VERSION(EXIV2_MAJOR_VERSION, EXIV2_MINOR_VERSION, EXIV2_PATCH_VERSION);
|
||||
}
|
||||
|
||||
std::string versionString()
|
||||
{
|
||||
std::ostringstream os;
|
||||
os << EXIV2_MAJOR_VERSION << '.' << EXIV2_MINOR_VERSION << '.' << EXIV2_PATCH_VERSION;
|
||||
return os.str();
|
||||
|
||||
}
|
||||
|
||||
std::string versionNumberHexString()
|
||||
{
|
||||
std::ostringstream os;
|
||||
@@ -120,45 +128,45 @@ typedef string_v::iterator string_i;
|
||||
|
||||
EXIV2API void dumpLibraryInfo(std::ostream& os)
|
||||
{
|
||||
string_v libs; // libs[0] == executable
|
||||
char builder[200];
|
||||
string_v libs; // libs[0] == executable
|
||||
|
||||
int bits = sizeof(void*);
|
||||
#if defined(_DEBUG) || defined(DEBUG)
|
||||
int debug=1;
|
||||
int bits = sizeof(void*);
|
||||
#if defined(_DEBUG) || defined(DEBUG)
|
||||
int debug=1;
|
||||
#else
|
||||
int debug=0;
|
||||
int debug=0;
|
||||
#endif
|
||||
|
||||
#if defined(EXV_HAVE_DLL)
|
||||
int dll=1;
|
||||
#if defined(EXV_HAVE_DLL)
|
||||
int dll=1;
|
||||
#else
|
||||
int dll=0;
|
||||
int dll=0;
|
||||
#endif
|
||||
|
||||
const char* compiler =
|
||||
#if defined(_MSC_VER)
|
||||
sprintf(builder,"MSVC=%d,DEBUG=%d,DLL=%d,Bits=%d" ,((_MSC_VER-600)/100),debug,dll,bits);
|
||||
"MSVC" ; // ((_MSC_VER-600)/100),debug,dll,bits);
|
||||
#elif defined(__clang__)
|
||||
sprintf(builder,"Clang=%s,DEBUG=%d,DLL=%d,Bits=%d" ,__clang_version__,debug,dll,bits);
|
||||
"Clang" ; // =%s,DEBUG=%d,DLL=%d,Bits=%d" ,__clang_version__,debug,dll,bits);
|
||||
#elif defined(__GNUG__)
|
||||
sprintf(builder,"G++=%s,DEBUG=%d,DLL=%d,Bits=%d" ,__VERSION__,debug,dll,bits);
|
||||
"G++" ; // =%s,DEBUG=%d,DLL=%d,Bits=%d" ,__VERSION__,debug,dll,bits);
|
||||
#elif defined(__GNUC__)
|
||||
sprintf(builder,"GCC=%s,DEBUG=%d,DLL=%d,Bits=%d" ,__VERSION__,debug,dll,bits);
|
||||
"GCC" ; // =%s,DEBUG=%d,DLL=%d,Bits=%d" ,__VERSION__,debug,dll,bits);
|
||||
#else
|
||||
sprintf(builder,"unknown=%s,DEBUG=%d,DLL=%d,Bits=%d",__VERSION__,debug,dll,bits);
|
||||
"unknown" ; // =%s,DEBUG=%d,DLL=%d,Bits=%d",__VERSION__,debug,dll,bits);
|
||||
#endif
|
||||
|
||||
const char* platform =
|
||||
const char* platform =
|
||||
#if defined(__CYGWIN__)
|
||||
"cygwin";
|
||||
"cygwin";
|
||||
#elif defined(_MSC_VER)
|
||||
"windows";
|
||||
"windows";
|
||||
#elif defined(__APPLE__)
|
||||
"apple";
|
||||
"apple";
|
||||
#elif defined(__linux__)
|
||||
"linux";
|
||||
"linux";
|
||||
#else
|
||||
"unknown";
|
||||
"unknown";
|
||||
#endif
|
||||
|
||||
#if defined(WIN32) || defined(__CYGWIN__)
|
||||
@@ -206,10 +214,16 @@ EXIV2API void dumpLibraryInfo(std::ostream& os)
|
||||
}
|
||||
#endif
|
||||
|
||||
os << "platform=" << platform << endl;
|
||||
os << "builder=" << builder << endl;
|
||||
os << "date=" << __DATE__ << endl;
|
||||
os << "time=" << __TIME__ << endl;
|
||||
os << "exiv2=" << Exiv2::versionString() << endl;
|
||||
os << "platform=" << platform << endl;
|
||||
os << "compiler=" << compiler << endl;
|
||||
os << "bits=" << bits << endl;
|
||||
os << "dll=" << dll << endl;
|
||||
os << "debug=" << debug << endl;
|
||||
os << "version=" << __VERSION__ << endl;
|
||||
os << "date=" << __DATE__ << endl;
|
||||
os << "time=" << __TIME__ << endl;
|
||||
|
||||
if ( libs.begin() != libs.end() ) {
|
||||
os << "executable=" << *libs.begin() << endl;
|
||||
for ( string_i lib = libs.begin()+1 ; lib != libs.end() ; lib++ )
|
||||
|
||||
+5
-2
@@ -121,6 +121,10 @@ namespace Exiv2 {
|
||||
@brief Return the version of %Exiv2 available at runtime as an integer.
|
||||
*/
|
||||
EXIV2API int versionNumber();
|
||||
/*!
|
||||
@brief Return the version string Example: "0.23.0" (major.minor.patch)
|
||||
*/
|
||||
EXIV2API std::string versionString();
|
||||
/*!
|
||||
@brief Return the version of %Exiv2 as hex string of fixed length 6.
|
||||
*/
|
||||
@@ -175,8 +179,7 @@ namespace Exiv2 {
|
||||
} // namespace Exiv2
|
||||
|
||||
// dumpLibraryInfo is general purpose and not in the Exiv2 namespace
|
||||
// dumpLibraryInfo reports on Windows/Linux/Mac, other platforms report nothing
|
||||
// dumpLibraryInfo used by exiv2 test suite to inspect loaded libraries at run-time
|
||||
// used by exiv2 test suite to inspect libraries loaded at run-time
|
||||
EXIV2API void dumpLibraryInfo(std::ostream& os);
|
||||
|
||||
|
||||
|
||||
Executable
+58
@@ -0,0 +1,58 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import os
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
##
|
||||
# process the version information dictionary
|
||||
def platform(dict):
|
||||
for k in sorted(dict.keys()):
|
||||
v=dict[k]
|
||||
if type(v)==type([]):
|
||||
v='['+str(len(v))+']'
|
||||
print "%-20s -> %s" % (k,v)
|
||||
##
|
||||
def apple(dict):
|
||||
platform(dict)
|
||||
##
|
||||
def linux(dict):
|
||||
platform(dict)
|
||||
##
|
||||
def windows(dict):
|
||||
platform(dict)
|
||||
##
|
||||
def cygwin(dict):
|
||||
platform(dict)
|
||||
##
|
||||
def mingw(dict):
|
||||
platform(dict)
|
||||
##
|
||||
def unknown(dict):
|
||||
platform(dict)
|
||||
|
||||
##
|
||||
# collect the version dictionary from exiv2
|
||||
dict={}
|
||||
output = subprocess.check_output( [ '../bin/exiv2', '-v', '-V' ])
|
||||
lines = output.split('\n')
|
||||
for l in lines:
|
||||
kv=l.split('=')
|
||||
if len(kv)==2:
|
||||
k=kv[0]
|
||||
v=kv[1]
|
||||
if not dict.has_key(k):
|
||||
dict[k]=[]
|
||||
dict[k].append(v)
|
||||
|
||||
# flatten value arrays of length 1
|
||||
for k in dict.keys():
|
||||
if len(dict[k])==1:
|
||||
dict[k]=dict[k][0]
|
||||
|
||||
##
|
||||
# analyse the version dictionary
|
||||
eval(dict['platform']+"(dict)")
|
||||
|
||||
# That's all Folks!
|
||||
##
|
||||
Reference in New Issue
Block a user