Skip to content

Commit

Permalink
Worked on tests
Browse files Browse the repository at this point in the history
  • Loading branch information
joachimmetz committed Oct 7, 2017
1 parent 80fa5cf commit f219788
Show file tree
Hide file tree
Showing 10 changed files with 113 additions and 35 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Expand Up @@ -47,13 +47,13 @@ matrix:
sudo: required
group: edge
before_install:
- if test ${TRAVIS_OS_NAME} = "linux"; then sudo apt-get update && sudo apt-mark hold oracle-java9-installer postgresql-9.2 postgresql-9.3 postgresql-9.4 postgresql-9.5 postgresql-9.6 postgresql-client postgresql-client-common postgresql-common postgresql-contrib-9.2 postgresql-contrib-9.3 postgresql-contrib-9.4 postgresql-contrib-9.5 postgresql-contrib-9.6 postgresql-doc && sudo apt-get --fix-missing -o Dpkg::Options::="--force-confold" upgrade -y && sudo apt-get install -y autopoint zlib1g-dev libfuse-dev; fi
- if test ${TRAVIS_OS_NAME} = "linux"; then sudo apt-get update && sudo apt-mark hold oracle-java9-installer postgresql-9.2 postgresql-9.3 postgresql-9.4 postgresql-9.5 postgresql-9.6 postgresql-client postgresql-client-common postgresql-common postgresql-contrib-9.2 postgresql-contrib-9.3 postgresql-contrib-9.4 postgresql-contrib-9.5 postgresql-contrib-9.6 postgresql-doc && sudo apt-get --fix-missing -o Dpkg::Options::="--force-confold" upgrade -y && sudo apt-get install -y autopoint zlib1g-dev libssl-dev libfuse-dev; fi
- if test ${TRAVIS_OS_NAME} = "osx"; then brew update && brew install gettext gnu-sed && brew link --force gettext; fi
- if test ${TARGET} = "coverity"; then echo -n | openssl s_client -connect scan.coverity.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca-; fi
install:
- if test ${TRAVIS_OS_NAME} = "osx"; then export SED="/usr/local/bin/gsed"; fi
- if test ${TARGET} = "shared"; then ./syncsharedlibs.sh; fi
- ./synclibs.sh && ./autogen.sh
- if test ${TARGET} = "shared"; then ./syncsharedlibs.sh --use-head; fi
- ./synclibs.sh --use-head && ./autogen.sh
- if test -x "synctestdata.sh"; then ./synctestdata.sh; fi
script:
- if test ${TRAVIS_OS_NAME} = "linux"; then export PATH=$(echo $PATH | tr ":" "\n" | sed '/\/opt\/python/d' | tr "\n" ":" | sed "s/::/:/g"); fi
Expand Down
32 changes: 19 additions & 13 deletions appveyor.yml
Expand Up @@ -37,59 +37,60 @@ environment:
- TARGET: mingw-w64

install:
- cmd: git clone https://github.com/codecov/codecov-bash.git ..\codecov-bash
- cmd: git clone https://github.com/libyal/vstools.git ..\vstools
- cmd: git clone https://github.com/joachimmetz/dokan.git ..\dokan
- ps: .\syncwinflexbison.ps1
- ps: .\synczlib.ps1
- cmd: if [%TARGET%]==[cygwin] (
C:\cygwin\setup-x86.exe -qgnNdO -l C:\cygwin\var\cache\setup -R c:\cygwin -s http://cygwin.mirror.constant.com -P bison -P flex -P python2-devel -P python3-devel )
C:\cygwin\setup-x86.exe -qgnNdO -l C:\cygwin\var\cache\setup -R c:\cygwin -s http://cygwin.mirror.constant.com -P bison -P flex -P zlib-devel -P openssl-devel -P python2-devel -P python3-devel )
- cmd: if [%TARGET%]==[cygwin64] (
C:\cygwin64\setup-x86_64.exe -qgnNdO -l C:\cygwin64\var\cache\setup -R c:\cygwin64 -s http://cygwin.mirror.constant.com -P bison -P flex -P python2-devel -P python3-devel )
C:\cygwin64\setup-x86_64.exe -qgnNdO -l C:\cygwin64\var\cache\setup -R c:\cygwin64 -s http://cygwin.mirror.constant.com -P bison -P flex -P zlib-devel -P openssl-devel -P python2-devel -P python3-devel )
- cmd: if [%TARGET%]==[mingw] (
C:\MinGW\bin\mingw-get install -P libz-dev )

build_script:
- ps: .\synclibs.ps1
- ps: .\autogen.ps1
- cmd: if [%TARGET%]==[vs2008] (
msbuild msvscpp\libewf.sln /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" )
msbuild /verbosity:quiet msvscpp\libewf.sln /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" )
- cmd: if [%TARGET%]==[vs2010] (
set PYTHONPATH=..\vstools &&
C:\Python27\python.exe ..\vstools\scripts\msvscpp-convert.py --no-python-dll --output-format 2010 msvscpp\libewf.sln &&
msbuild vs2010\libewf.sln /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" )
msbuild /verbosity:quiet vs2010\libewf.sln /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" )
- cmd: if [%TARGET%]==[vs2012] (
set PYTHONPATH=..\vstools &&
C:\Python27\python.exe ..\vstools\scripts\msvscpp-convert.py --extend-with-x64 --output-format 2012 --python-path "C:\\Python27-x64" msvscpp\libewf.sln &&
msbuild vs2012\libewf.sln /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" )
msbuild /verbosity:quiet vs2012\libewf.sln /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" )
- cmd: if [%TARGET%]==[vs2013] (
set PYTHONPATH=..\vstools &&
C:\Python27\python.exe ..\vstools\scripts\msvscpp-convert.py --output-format 2013 msvscpp\libewf.sln &&
msbuild vs2013\libewf.sln /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" )
msbuild /verbosity:quiet vs2013\libewf.sln /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" )
- cmd: if [%TARGET%]==[vs2015] (
set PYTHONPATH=..\vstools &&
C:\Python27\python.exe ..\vstools\scripts\msvscpp-convert.py --output-format 2015 msvscpp\libewf.sln &&
msbuild vs2015\libewf.sln /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" )
msbuild /verbosity:quiet vs2015\libewf.sln /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" )
- cmd: if [%TARGET%]==[vs2017] (
set PYTHONPATH=..\vstools &&
C:\Python27\python.exe ..\vstools\scripts\msvscpp-convert.py --extend-with-x64 --no-python-dll --output-format 2017 msvscpp\libewf.sln &&
msbuild vs2017\libewf.sln /property:Platform=Win32 /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" &&
msbuild vs2017\libewf.sln /property:Platform=x64 /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" )
msbuild /verbosity:quiet vs2017\libewf.sln /property:Platform=Win32 /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" &&
msbuild /verbosity:quiet vs2017\libewf.sln /property:Platform=x64 /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" )
- cmd: if [%TARGET%]==[python27] (
C:\Python27\python.exe setup.py bdist_msi )
- cmd: if [%TARGET%]==[python36] (
C:\Python36\python.exe setup.py bdist_msi )
- cmd: if [%TARGET%]==[cygwin] (
xcopy /i /q /s C:\projects\libewf C:\cygwin\home\appveyor\libewf &&
C:\cygwin\bin\bash -e -l -c "cd libewf && ./synclibs.sh && ./autogen.sh" )
C:\cygwin\bin\bash -e -l -c "cd libewf && ./synclibs.sh --use-head && ./autogen.sh" )
- cmd: if [%TARGET%]==[cygwin64] (
xcopy /i /q /s C:\projects\libewf C:\cygwin64\home\appveyor\libewf &&
C:\cygwin64\bin\bash -e -l -c "cd libewf && ./synclibs.sh && ./autogen.sh" )
C:\cygwin64\bin\bash -e -l -c "cd libewf && ./synclibs.sh --use-head && ./autogen.sh" )
- cmd: if [%TARGET%]==[mingw] (
xcopy /i /q /s C:\projects\libewf C:\MinGW\msys\1.0\home\appveyor\libewf &&
C:\MinGW\msys\1.0\bin\bash -e -l -c "cd libewf && sed 's/@VERSION@/0.29/g' m4/pkg.m4.in > m4/pkg.m4 && ./synclibs.sh && ./autogen.sh" )
C:\MinGW\msys\1.0\bin\bash -e -l -c "cd libewf && sed 's/@VERSION@/0.29/g' m4/pkg.m4.in > m4/pkg.m4 && ./synclibs.sh --use-head && ./autogen.sh" )
- cmd: if [%TARGET%]==[mingw-w64] (
xcopy /i /q /s C:\projects\libewf C:\msys64\home\appveyor\libewf &&
C:\msys64\usr\bin\bash -e -l -c "cd libewf && ./synclibs.sh && ./autogen.sh" )
C:\msys64\usr\bin\bash -e -l -c "cd libewf && ./synclibs.sh --use-head && ./autogen.sh" )

test_script:
- cmd: rem Run tests
Expand All @@ -114,3 +115,8 @@ test_script:
- cmd: if [%TARGET%]==[mingw-w64] (
C:\msys64\usr\bin\bash -e -l -c "cd libewf && ./runtests.sh" )

after_test:
- cmd: if [%TARGET%]==[mingw] (
copy C:\projects\codecov-bash\codecov C:\MinGW\msys\1.0\home\appveyor\libewf\codecov.sh &&
C:\MinGW\msys\1.0\bin\bash -e -l -c "cd libewf && chmod a+x ./codecov.sh && ./codecov.sh" )

11 changes: 7 additions & 4 deletions common/system_string.h
Expand Up @@ -83,11 +83,11 @@ extern "C" {
#endif

#if defined( __BORLANDC__ ) && ( __BORLANDC__ < 0x0560 )
#define system_string_vsprintf \
#define system_string_vsnprintf \
wide_string_vsnwprintf

#else
#define system_string_vsprintf( string, size, format, ... ) \
#define system_string_vsnprintf( string, size, format, ... ) \
wide_string_vsnwprintf( string, size, format, __VA_ARGS__ )
#endif

Expand Down Expand Up @@ -133,16 +133,19 @@ extern "C" {
#endif

#if defined( __BORLANDC__ ) && ( __BORLANDC__ < 0x0560 )
#define system_string_vsprintf \
#define system_string_vsnprintf \
narrow_string_vsnprintf

#else
#define system_string_vsprintf( string, size, format, ... ) \
#define system_string_vsnprintf( string, size, format, ... ) \
narrow_string_vsnprintf( string, size, format, __VA_ARGS__ )
#endif

#endif /* defined( HAVE_WIDE_SYSTEM_CHARACTER ) */

/* For backwards compatibility */
#define system_string_vsprintf system_string_vsnprintf

#if defined( _cplusplus )
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Expand Up @@ -2,7 +2,7 @@ AC_PREREQ( 2.59 )

AC_INIT(
[libewf],
[20170918],
[20171007],
[joachim.metz@gmail.com])

AC_CONFIG_SRCDIR(
Expand Down
2 changes: 1 addition & 1 deletion dpkg/control
@@ -1,7 +1,7 @@
Source: libewf
Priority: extra
Maintainer: Joachim Metz <joachim.metz@gmail.com>
Build-Depends: debhelper (>= 9), dh-autoreconf, pkg-config, zlib1g-dev, libssl-dev, libfuse-dev, python-dev, python3-dev
Build-Depends: debhelper (>= 9), dh-autoreconf, pkg-config, zlib1g-dev, libssl-dev, python-dev, python3-dev, libfuse-dev
Standards-Version: 3.9.5
Section: libs
Homepage: https://github.com/libyal/libewf
Expand Down
3 changes: 1 addition & 2 deletions libewf.ini
Expand Up @@ -16,7 +16,7 @@ year_of_creation: "2008"
[tools]
build_dependencies: ["crypto", "fuse"]
description: "Several tools for reading and writing EWF files"
names: ["ewfacquire", "ewfacquirestream", "ewfexport", "ewfinfo", "ewfmount", "ewfverify"]
names: ["ewfacquire", "ewfacquirestream", "ewfdebug", "ewfexport", "ewfinfo", "ewfmount", "ewfrecover", "ewfverify"]

[mount_tool]
missing_backend_error: "No sub system to mount EWF."
Expand All @@ -42,7 +42,6 @@ main_object_size: "media_size"
example: "ewfinfo image.E01"

[tests]
features: ["profiles", "valgrind"]
profiles: ["libewf", "pyewf", "ewfacquire", "ewfacquire_optical", "ewfacquirestream", "ewfexport", "ewfexport_logical", "ewfinfo", "ewfverify", "ewfverify_logical"]
example_filename1: "image1.E01"
example_filename2: "image2.Ex02"
Expand Down
1 change: 0 additions & 1 deletion libewf.spec.in
Expand Up @@ -41,7 +41,6 @@ BuildRequires: byacc flex @ax_libcdatetime_spec_build_requires@ @ax_libfuse_spec

%description tools
Several tools for reading and writing EWF files.
It contains tools to acquire, export, query and verify EWF files.

%package python
Summary: Python 2 bindings for libewf
Expand Down
5 changes: 4 additions & 1 deletion m4/zlib.m4
@@ -1,6 +1,6 @@
dnl Functions for zlib
dnl
dnl Version: 20160318
dnl Version: 20171006

dnl Function to detect if zlib is available
AC_DEFUN([AX_ZLIB_CHECK_LIB],
Expand Down Expand Up @@ -264,6 +264,9 @@ AC_DEFUN([AX_ZLIB_CHECK_ENABLE],
AC_SUBST(
[ax_zlib_spec_build_requires],
[zlib-devel])
AC_SUBST(
[ax_zlib_static_spec_requires],
[zlib-static])
AC_SUBST(
[ax_zlib_static_spec_build_requires],
[zlib-static])
Expand Down
35 changes: 31 additions & 4 deletions synclibs.sh
@@ -1,7 +1,10 @@
#!/bin/sh
# Script that synchronizes the local library dependencies
#
# Version: 20161212
# Version: 20171003

EXIT_SUCCESS=0;
EXIT_FAILURE=1;

GIT_URL_PREFIX="https://github.com/libyal";
LOCAL_LIBS="libbfio libcaes libcdata libcdatetime libcerror libcfile libclocale libcnotify libcpath libcsplit libcthreads libfcache libfdata libfguid libfvalue libhmac libodraw libsmdev libsmraw libuna";
Expand All @@ -11,19 +14,41 @@ IFS=" ";

for LOCAL_LIB in ${LOCAL_LIBS};
do
git clone ${GIT_URL_PREFIX}/${LOCAL_LIB}.git ${LOCAL_LIB}-$$;
GIT_URL="${GIT_URL_PREFIX}/${LOCAL_LIB}.git";

git clone --quiet ${GIT_URL} ${LOCAL_LIB}-$$;

if ! test -d ${LOCAL_LIB}-$$;
then
continue
echo "Unable to git clone: ${GIT_URL}";

IFS=$OLDIFS;

exit ${EXIT_FAILURE};
fi
(cd ${LOCAL_LIB}-$$ && git fetch --quiet --all --tags --prune)

LATEST_TAG=`cd ${LOCAL_LIB}-$$ && git describe --tags --abbrev=0`;

if test -n ${LATEST_TAG} && test "$1" != "--use-head";
then
echo "Synchronizing: ${LOCAL_LIB} from ${GIT_URL} tag ${LATEST_TAG}";

(cd ${LOCAL_LIB}-$$ && git checkout --quiet tags/${LATEST_TAG});
else
echo "Synchronizing: ${LOCAL_LIB} from ${GIT_URL} HEAD";
fi

rm -rf ${LOCAL_LIB};
mkdir ${LOCAL_LIB};

if ! test -d ${LOCAL_LIB};
then
continue
echo "Missing directory: ${LOCAL_LIB}";

IFS=$OLDIFS;

exit ${EXIT_FAILURE};
fi

LOCAL_LIB_UPPER=`echo "${LOCAL_LIB}" | tr "[a-z]" "[A-Z]"`;
Expand Down Expand Up @@ -150,3 +175,5 @@ done

IFS=$OLDIFS;

exit ${EXIT_SUCCESS};

51 changes: 46 additions & 5 deletions syncsharedlibs.sh
@@ -1,10 +1,13 @@
#!/bin/sh
# Script that synchronizes the shared library dependencies
#
# Version: 20170903
# Version: 20170905

EXIT_SUCCESS=0;
EXIT_FAILURE=1;

GIT_URL_PREFIX="https://github.com/libyal";
SHARED_LIBS="libbfio libcaes libcdata libcdatetime libcerror libcfile libclocale libcnotify libcpath libcsplit libcthreads libfcache libfdata libfguid libfvalue libhmac libodraw libsmdev libsmraw libuna";
SHARED_LIBS="libcerror libcthreads libcdata libcdatetime libclocale libcnotify libcsplit libuna libcfile libcpath libbfio libfcache libfdata libfguid libfvalue libhmac libcaes libodraw libsmdev libsmraw";

if test ${TRAVIS_OS_NAME} != "linux";
then
Expand All @@ -13,22 +16,60 @@ then
exit 1;
fi

USE_HEAD="";

if test "$1" = "--use-head";
then
USE_HEAD="--use-head";
fi

OLDIFS=$IFS;
IFS=" ";

for SHARED_LIB in ${SHARED_LIBS};
do
git clone ${GIT_URL_PREFIX}/${SHARED_LIB}.git ${SHARED_LIB}-$$;
GIT_URL="${GIT_URL_PREFIX}/${SHARED_LIB}.git";

git clone --quiet ${GIT_URL} ${SHARED_LIB}-$$;

if ! test -d ${SHARED_LIB}-$$;
then
continue
echo "Unable to git clone: ${GIT_URL}";

IFS=$OLDIFS;

exit ${EXIT_FAILURE};
fi
(cd ${SHARED_LIB}-$$ && git fetch --quiet --all --tags --prune)

LATEST_TAG=`cd ${SHARED_LIB}-$$ && git describe --tags --abbrev=0`;

if test -n ${LATEST_TAG} && test -z ${USE_HEAD};
then
echo "Synchronizing: ${SHARED_LIB} from ${GIT_URL} tag ${LATEST_TAG}";

(cd ${SHARED_LIB}-$$ && git checkout --quiet tags/${LATEST_TAG});
else
echo "Synchronizing: ${SHARED_LIB} from ${GIT_URL} HEAD";
fi

(cd ${SHARED_LIB}-$$ && ./synclibs.sh ${USE_HEAD} && ./autogen.sh);

CONFIGURE_OPTIONS="";

(cd ${SHARED_LIB}-$$ && ./configure --help | grep -- '--enable-wide-character-type' > /dev/null);

if test $? -eq 0;
then
CONFIGURE_OPTIONS="${CONFIGURE_OPTIONS} --enable-wide-character-type";
fi

(cd ${SHARED_LIB}-$$ && ./synclibs.sh && ./autogen.sh && ./configure --prefix=/usr && make && sudo make install);
(cd ${SHARED_LIB}-$$ && ./configure --prefix=/usr ${CONFIGURE_OPTIONS} && make && sudo make install);

rm -rf ${SHARED_LIB}-$$;
done

IFS=$OLDIFS;

exit ${EXIT_SUCCESS};

0 comments on commit f219788

Please sign in to comment.