Browse Source

Worked on tests

tags/20180714
Joachim Metz 2 years ago
parent
commit
651aec5f8a
55 changed files with 1452 additions and 745 deletions
  1. +33
    -9
      .travis.yml
  2. +52
    -25
      appveyor.yml
  3. +9
    -10
      autogen.sh
  4. +1
    -1
      configure.ac
  5. +3
    -0
      libpff.ini
  6. +9
    -1
      libpff/libpff_definitions.h.in
  7. +40
    -2
      libpff/libpff_descriptor_data_stream.c
  8. +5
    -0
      libpff/libpff_descriptor_data_stream.h
  9. +1
    -0
      libpff/libpff_item.c
  10. +1
    -0
      libpff/libpff_record_entry.c
  11. +10
    -12
      libpff/libpff_record_set.c
  12. +1
    -1
      libpff/libpff_record_set.h
  13. +1
    -1
      libpff/libpff_table.c
  14. +277
    -0
      m4/pkg.m4.in
  15. +478
    -472
      m4/python.m4
  16. +81
    -4
      runtests.sh
  17. +6
    -1
      synclibs.ps1
  18. +1
    -0
      tests/lsan.suppressions
  19. +4
    -4
      tests/pff_test_attached_file_io_handle.c
  20. +4
    -4
      tests/pff_test_column_definition.c
  21. +4
    -4
      tests/pff_test_data_array.c
  22. +4
    -4
      tests/pff_test_data_array_entry.c
  23. +4
    -4
      tests/pff_test_data_block.c
  24. +4
    -4
      tests/pff_test_deflate.c
  25. +4
    -4
      tests/pff_test_descriptors_index.c
  26. +2
    -2
      tests/pff_test_file.c
  27. +2
    -2
      tests/pff_test_folder.c
  28. +4
    -4
      tests/pff_test_index.c
  29. +4
    -4
      tests/pff_test_index_node.c
  30. +4
    -4
      tests/pff_test_index_value.c
  31. +4
    -4
      tests/pff_test_io_handle.c
  32. +6
    -6
      tests/pff_test_item.c
  33. +4
    -4
      tests/pff_test_item_descriptor.c
  34. +4
    -4
      tests/pff_test_item_values.c
  35. +4
    -4
      tests/pff_test_local_descriptor_node.c
  36. +4
    -4
      tests/pff_test_local_descriptor_value.c
  37. +4
    -4
      tests/pff_test_local_descriptors.c
  38. +5
    -3
      tests/pff_test_memory.c
  39. +1
    -1
      tests/pff_test_memory.h
  40. +6
    -6
      tests/pff_test_message.c
  41. +8
    -8
      tests/pff_test_multi_value.c
  42. +4
    -4
      tests/pff_test_offsets_index.c
  43. +18
    -2
      tests/pff_test_read_items.c
  44. +16
    -16
      tests/pff_test_record_entry.c
  45. +16
    -16
      tests/pff_test_record_set.c
  46. +4
    -4
      tests/pff_test_reference_descriptor.c
  47. +4
    -4
      tests/pff_test_table.c
  48. +4
    -4
      tests/pff_test_table_block_index.c
  49. +4
    -4
      tests/pff_test_table_index_value.c
  50. +23
    -7
      tests/test_library.ps1
  51. +5
    -11
      tests/test_library.sh
  52. +25
    -11
      tests/test_pffinfo.ps1
  53. +5
    -13
      tests/test_pffinfo.sh
  54. +4
    -9
      tests/test_python_module.sh
  55. +217
    -9
      tests/test_runner.sh

+ 33
- 9
.travis.yml View File

@@ -1,15 +1,39 @@
sudo: required
dist: trusty
language: c
os:
- linux
- osx
compiler:
- clang
- gcc
env:
global:
# Encrypted COVERITY_SCAN_TOKEN
- secure: "p17X8wFVnUeU3oGAUeUpOJknniwIkliHaLLeHWNHrX1Op794acHEz8wVyuVHLxf5B1Irm8R4UXslzM4y/qAPIB03uaeiam9JJXLVXvKtalMxn856hx9+4TWie/HWQjoKQp4zEgUbLrvSkSW2NYUkFjnY3BvotoqyRW3BlYPonw0="
matrix:
include:
- compiler: clang
os: linux
dist: trusty
sudo: required
group: edge
addons:
coverity_scan:
project:
name: "libyal/libpff"
description: "Build submitted via Travis CI"
notification_email: joachim.metz@gmail.com
build_command_prepend: "./synclibs.sh && ./autogen.sh && ./configure"
build_command: "make -j4"
branch_pattern: master
- compiler: gcc
os: linux
dist: trusty
sudo: required
group: edge
- compiler: clang
os: osx
osx_image: xcode8.1
- compiler: gcc
os: osx
osx_image: xcode8.1
before_install:
- if test ${TRAVIS_OS_NAME} = "osx"; then brew update && brew install gettext gnu-sed && brew link --force gettext; fi
- if test ${TRAVIS_OS_NAME} = "linux"; 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
- 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; fi
- if test ${TRAVIS_OS_NAME} = "osx"; then brew update && brew install gettext gnu-sed && brew link --force gettext; fi
install:
- if test ${TRAVIS_OS_NAME} = "osx"; then export SED="/usr/local/bin/gsed"; fi
- ./synclibs.sh && ./autogen.sh


+ 52
- 25
appveyor.yml View File

@@ -3,33 +3,42 @@ environment:
- TARGET: vs2008
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
VisualStudioVersion: 9.0
platform: Win32
configuration: Release
- TARGET: vs2010
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
VisualStudioVersion: 10.0
platform: Win32
configuration: VSDebug
- TARGET: vs2012
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
VisualStudioVersion: 11.0
platform: x64
configuration: Release
- TARGET: vs2013
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
VisualStudioVersion: 12.0
platform: Win32
configuration: Release
- TARGET: vs2015
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
VisualStudioVersion: 14.0
platform: Win32
configuration: Release
- TARGET: python27
- TARGET: python36
- TARGET: cygwin
- TARGET: mingw32
- TARGET: mingw64

# TODO: add x64, fix issue: LNK1158: cannot run 'cvtres.exe'
platform:
- Win32

# TODO: add VSDebug
configuration:
- Release
- TARGET: cygwin64
- TARGET: mingw
- TARGET: mingw-w64

install:
- cmd: git clone https://github.com/libyal/libyal.git && move libyal ..\
- cmd: git clone https://github.com/libyal/vstools.git && move vstools ..\
- 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 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 python2-devel -P python3-devel )

build_script:
- ps: .\synclibs.ps1
@@ -37,32 +46,42 @@ build_script:
- cmd: if [%TARGET%]==[vs2008] (
msbuild msvscpp\libpff.sln /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" )
- cmd: if [%TARGET%]==[vs2010] (
C:\Python27\python.exe ..\libyal\scripts\msvscpp-convert.py --to 2010 msvscpp\libpff.sln &&
set PYTHONPATH=..\vstools &&
C:\Python27\python.exe ..\vstools\scripts\msvscpp-convert.py --to 2010 msvscpp\libpff.sln &&
msbuild vs2010\libpff.sln /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" )
- cmd: if [%TARGET%]==[vs2012] (
C:\Python27\python.exe ..\libyal\scripts\msvscpp-convert.py --to 2012 msvscpp\libpff.sln &&
set PYTHONPATH=..\vstools &&
C:\Python27\python.exe ..\vstools\scripts\msvscpp-convert.py --to 2012 msvscpp\libpff.sln &&
msbuild vs2012\libpff.sln /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" )
- cmd: if [%TARGET%]==[vs2013] (
C:\Python27\python.exe ..\libyal\scripts\msvscpp-convert.py --to 2013 msvscpp\libpff.sln &&
set PYTHONPATH=..\vstools &&
C:\Python27\python.exe ..\vstools\scripts\msvscpp-convert.py --to 2013 msvscpp\libpff.sln &&
msbuild vs2013\libpff.sln /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" )
- cmd: if [%TARGET%]==[vs2015] (
C:\Python27\python.exe ..\libyal\scripts\msvscpp-convert.py --to 2015 msvscpp\libpff.sln &&
set PYTHONPATH=..\vstools &&
C:\Python27\python.exe ..\vstools\scripts\msvscpp-convert.py --to 2015 msvscpp\libpff.sln &&
msbuild vs2015\libpff.sln /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 /q /s C:\projects\libpff C:\cygwin\home\appveyor\ &&
C:\cygwin\bin\bash -e -l -c "cd libpff" &&
C:\cygwin\bin\bash -e -l -c "./synclibs.sh && ./autogen.sh" &&
C:\cygwin\bin\bash -e -l -c "./configure && make -j4" )
- cmd: if [%TARGET%]==[mingw32] (
C:\cygwin\bin\bash -e -l -c "./synclibs.sh && ./autogen.sh" )
- cmd: if [%TARGET%]==[cygwin64] (
xcopy /q /s C:\projects\libpff C:\cygwin64\home\appveyor\ &&
C:\cygwin64\bin\bash -e -l -c "cd libpff" &&
C:\cygwin64\bin\bash -e -l -c "./synclibs.sh && ./autogen.sh" )
- cmd: if [%TARGET%]==[mingw] (
xcopy /q /s C:\projects\libpff C:\MinGW\msys\1.0\home\appveyor\ &&
C:\MinGW\msys\1.0\bin\bash -e -l -c "cd libpff" &&
C:\MinGW\msys\1.0\bin\bash -e -l -c "sed 's/@VERSION@/0.29/g' m4/pkg.m4.in > m4/pkg.m4" &&
C:\MinGW\msys\1.0\bin\bash -e -l -c "./synclibs.sh && ./autogen.sh" )
- cmd: if [%TARGET%]==[mingw-w64] (
xcopy /q /s C:\projects\libpff C:\msys64\home\appveyor\ &&
C:\msys64\usr\bin\bash -e -l -c "cd libpff" &&
C:\msys64\usr\bin\bash -e -l -c "./synclibs.sh && ./autogen.sh" &&
C:\msys64\usr\bin\bash -e -l -c "./configure --host=i686-w64-mingw32 && make -j4" )
- cmd: if [%TARGET%]==[mingw64] (
xcopy /q /s C:\projects\libpff C:\msys64\home\appveyor\ &&
C:\msys64\usr\bin\bash -e -l -c "cd libpff" &&
C:\msys64\usr\bin\bash -e -l -c "./synclibs.sh && ./autogen.sh" &&
C:\msys64\usr\bin\bash -e -l -c "./configure --host=x86_64-w64-mingw32 && make -j4" )
C:\msys64\usr\bin\bash -e -l -c "./synclibs.sh && ./autogen.sh" )

test_script:
- cmd: rem Run tests
@@ -76,4 +95,12 @@ test_script:
.\runtests.ps1 }
- ps: if ($env:TARGET -eq "vs2015") {
.\runtests.ps1 }
- cmd: if [%TARGET%]==[cygwin] (
C:\cygwin\bin\bash -e -l -c "./runtests.sh" )
- cmd: if [%TARGET%]==[cygwin64] (
C:\cygwin64\bin\bash -e -l -c "./runtests.sh" )
- cmd: if [%TARGET%]==[mingw] (
C:\MinGW\msys\1.0\bin\bash -e -l -c "./runtests.sh" )
- cmd: if [%TARGET%]==[mingw-w64] (
C:\msys64\usr\bin\bash -e -l -c "./runtests.sh" )


+ 9
- 10
autogen.sh View File

@@ -1,7 +1,7 @@
#!/bin/sh
# Script to generate ./configure using the autotools
#
# Version: 20170723
# Version: 20170724

EXIT_SUCCESS=0;
EXIT_FAILURE=1;
@@ -53,17 +53,10 @@ AUTORECONF="${BINDIR}/autoreconf";
LIBTOOLIZE="${BINDIR}/libtoolize";
PKGCONFIG="${BINDIR}/pkg-config";

if test "${OSTYPE}" != "msys" && ! test -x "${PKGCONFIG}";
then
echo "Unable to find: pkg-config";

exit ${EXIT_FAILURE};
fi

if test "${OSTYPE}" = "msys";
then
# Work-around autopoint failing to detect gettext version
# using func_trace which is not available on MSYS by writing
# Work-around for autopoint failing to detect gettext version
# using func_trace (which is not available) on MSYS by writing
# the gettext version to intl/VERSION.
if ! test -d intl;
then
@@ -72,6 +65,12 @@ then
GETTEXT_VERSION=`gettext --version | head -n1 | sed 's/^.* //'`;

echo "gettext-${GETTEXT_VERSION}" > intl/VERSION;

elif ! test -x "${PKGCONFIG}";
then
echo "Unable to find: pkg-config";

exit ${EXIT_FAILURE};
fi

if test -x "${AUTORECONF}";


+ 1
- 1
configure.ac View File

@@ -2,7 +2,7 @@ AC_PREREQ( 2.59 )

AC_INIT(
[libpff],
[20170724],
[20170825],
[joachim.metz@gmail.com])

AC_CONFIG_SRCDIR(


+ 3
- 0
libpff.ini View File

@@ -65,3 +65,6 @@ build_dependencies: [
build_dependencies: [
"zlib1g-dev"]

[coverty]
scan_token: "p17X8wFVnUeU3oGAUeUpOJknniwIkliHaLLeHWNHrX1Op794acHEz8wVyuVHLxf5B1Irm8R4UXslzM4y/qAPIB03uaeiam9JJXLVXvKtalMxn856hx9+4TWie/HWQjoKQp4zEgUbLrvSkSW2NYUkFjnY3BvotoqyRW3BlYPonw0="


+ 9
- 1
libpff/libpff_definitions.h.in View File

@@ -425,5 +425,13 @@ enum LIBPFF_NAME_TO_ID_MAP_ENTRY_FLAGS
#define LIBPFF_MAXIMUM_CACHE_ENTRIES_DATA_BLOCK 1
#define LIBPFF_MAXIMUM_CACHE_ENTRIES_ITEM 8

#endif
/* The descriptor data stream data handle flags
*/
enum LIBPFF_DESCRIPTOR_DATA_STREAM_DATA_HANDLE_FLAGS
{
LIBPFF_DESCRIPTOR_DATA_STREAM_DATA_HANDLE_FLAG_NON_MANAGED = 0,
LIBPFF_DESCRIPTOR_DATA_STREAM_DATA_HANDLE_FLAG_MANAGED = 1
};

#endif /* !defined( _LIBPFF_INTERNAL_DEFINITIONS_H ) */


+ 40
- 2
libpff/libpff_descriptor_data_stream.c View File

@@ -24,6 +24,7 @@
#include <types.h>

#include "libpff_data_block.h"
#include "libpff_definitions.h"
#include "libpff_descriptor_data_stream.h"
#include "libpff_libcerror.h"
#include "libpff_libfcache.h"
@@ -111,6 +112,7 @@ int libpff_descriptor_data_stream_data_handle_free(
libcerror_error_t **error )
{
static char *function = "libpff_descriptor_data_stream_data_handle_free";
int result = 1;

if( data_handle == NULL )
{
@@ -125,13 +127,47 @@ int libpff_descriptor_data_stream_data_handle_free(
}
if( *data_handle != NULL )
{
/* TODO free list and cache ? */
if( ( *data_handle )->flags == LIBPFF_DESCRIPTOR_DATA_STREAM_DATA_HANDLE_FLAG_MANAGED )
{
if( ( *data_handle )->descriptor_data_cache != NULL )
{
if( libfcache_cache_free(
&( ( *data_handle )->descriptor_data_cache ),
error ) != 1 )
{
libcerror_error_set(
error,
LIBCERROR_ERROR_DOMAIN_RUNTIME,
LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED,
"%s: unable to free descriptor data cache.",
function );

result = -1;
}
}
if( ( *data_handle )->descriptor_data_list != NULL )
{
if( libfdata_list_free(
&( ( *data_handle )->descriptor_data_list ),
error ) != 1 )
{
libcerror_error_set(
error,
LIBCERROR_ERROR_DOMAIN_RUNTIME,
LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED,
"%s: unable to free descriptor data list.",
function );

result = -1;
}
}
}
memory_free(
*data_handle );

*data_handle = NULL;
}
return( 1 );
return( result );
}

/* Clones (duplicates) the data handle
@@ -405,6 +441,7 @@ int libpff_descriptor_data_stream_initialize(
libfdata_stream_t **descriptor_data_stream,
libfdata_list_t *descriptor_data_list,
libfcache_cache_t *descriptor_data_cache,
uint8_t flags,
libcerror_error_t **error )
{
libpff_descriptor_data_stream_data_handle_t *data_handle = NULL;
@@ -556,6 +593,7 @@ int libpff_descriptor_data_stream_initialize(
}
data_handle->descriptor_data_list = descriptor_data_list;
data_handle->descriptor_data_cache = descriptor_data_cache;
data_handle->flags = flags;

return( 1 );



+ 5
- 0
libpff/libpff_descriptor_data_stream.h View File

@@ -48,6 +48,10 @@ struct libpff_descriptor_data_stream_data_handle
/* The descriptor data cache
*/
libfcache_cache_t *descriptor_data_cache;

/* The flags
*/
uint8_t flags;
};

int libpff_descriptor_data_stream_data_handle_initialize(
@@ -86,6 +90,7 @@ int libpff_descriptor_data_stream_initialize(
libfdata_stream_t **descriptor_data_stream,
libfdata_list_t *descriptor_data_list,
libfcache_cache_t *descriptor_data_cache,
uint8_t flags,
libcerror_error_t **error );

#if defined( __cplusplus )


+ 1
- 0
libpff/libpff_item.c View File

@@ -2121,6 +2121,7 @@ int libpff_internal_item_get_embedded_object_data(
&( internal_item->embedded_object_data_stream ),
embedded_object_data_list,
embedded_object_data_cache,
LIBPFF_DESCRIPTOR_DATA_STREAM_DATA_HANDLE_FLAG_MANAGED,
error ) != 1 )
{
libcerror_error_set(


+ 1
- 0
libpff/libpff_record_entry.c View File

@@ -653,6 +653,7 @@ int libpff_record_entry_set_value_data_from_list(
&value_data_stream,
value_data_list,
value_data_cache,
LIBPFF_DESCRIPTOR_DATA_STREAM_DATA_HANDLE_FLAG_NON_MANAGED,
error ) != 1 )
{
libcerror_error_set(


+ 10
- 12
libpff/libpff_record_set.c View File

@@ -219,14 +219,13 @@ int libpff_record_set_free(
* Returns 1 if successful or -1 on error
*/
int libpff_internal_record_set_free(
libpff_record_set_t **record_set,
libpff_internal_record_set_t **internal_record_set,
libcerror_error_t **error )
{
libpff_internal_record_set_t *internal_record_set = NULL;
static char *function = "libpff_internal_record_set_free";
int result = 1;
static char *function = "libpff_internal_record_set_free";
int result = 1;

if( record_set == NULL )
if( internal_record_set == NULL )
{
libcerror_error_set(
error,
@@ -237,13 +236,10 @@ int libpff_internal_record_set_free(

return( -1 );
}
if( *record_set != NULL )
if( *internal_record_set != NULL )
{
internal_record_set = (libpff_internal_record_set_t *) *record_set;
*record_set = NULL;

if( libcdata_array_free(
&( internal_record_set->entries_array ),
&( ( *internal_record_set )->entries_array ),
(int (*)(intptr_t **, libcerror_error_t **)) &libpff_internal_record_entry_free,
error ) != 1 )
{
@@ -257,7 +253,9 @@ int libpff_internal_record_set_free(
result = -1;
}
memory_free(
internal_record_set );
*internal_record_set );

*internal_record_set = NULL;
}
return( result );
}
@@ -360,7 +358,7 @@ on_error:
if( internal_destination_record_set != NULL )
{
libpff_internal_record_set_free(
(libpff_record_set_t **) &internal_destination_record_set,
&internal_destination_record_set,
NULL );
}
return( -1 );


+ 1
- 1
libpff/libpff_record_set.h View File

@@ -59,7 +59,7 @@ int libpff_record_set_free(
libcerror_error_t **error );

int libpff_internal_record_set_free(
libpff_record_set_t **record_set,
libpff_internal_record_set_t **internal_record_set,
libcerror_error_t **error );

int libpff_record_set_clone(


+ 1
- 1
libpff/libpff_table.c View File

@@ -662,7 +662,7 @@ on_error:
if( record_set != NULL )
{
libpff_internal_record_set_free(
&record_set,
(libpff_internal_record_set_t **) &record_set,
NULL );
}
if( last_number_of_entries != number_of_entries )


+ 277
- 0
m4/pkg.m4.in View File

@@ -0,0 +1,277 @@
# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
# serial 12 (pkg-config-@VERSION@)
#
# Copied from: https://cgit.freedesktop.org/pkg-config/plain/pkg.m4.in

dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
dnl
dnl This program is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; either version 2 of the License, or
dnl (at your option) any later version.
dnl
dnl This program is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
dnl General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with this program; if not, write to the Free Software
dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
dnl 02111-1307, USA.
dnl
dnl As a special exception to the GNU General Public License, if you
dnl distribute this file as part of a program that contains a
dnl configuration script generated by Autoconf, you may include it under
dnl the same distribution terms that you use for the rest of that
dnl program.

dnl PKG_PREREQ(MIN-VERSION)
dnl -----------------------
dnl Since: 0.29
dnl
dnl Verify that the version of the pkg-config macros are at least
dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
dnl installed version of pkg-config, this checks the developer's version
dnl of pkg.m4 when generating configure.
dnl
dnl To ensure that this macro is defined, also add:
dnl m4_ifndef([PKG_PREREQ],
dnl [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
dnl
dnl See the "Since" comment for each macro you use to see what version
dnl of the macros you require.
m4_defun([PKG_PREREQ],
[m4_define([PKG_MACROS_VERSION], [@VERSION@])
m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
[m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
])dnl PKG_PREREQ

dnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
dnl ----------------------------------
dnl Since: 0.16
dnl
dnl Search for the pkg-config tool and set the PKG_CONFIG variable to
dnl first found in the path. Checks that the version of pkg-config found
dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
dnl used since that's the first version where most current features of
dnl pkg-config existed.
AC_DEFUN([PKG_PROG_PKG_CONFIG],
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])

if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
fi
if test -n "$PKG_CONFIG"; then
_pkg_min_version=m4_default([$1], [0.9.0])
AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
PKG_CONFIG=""
fi
fi[]dnl
])dnl PKG_PROG_PKG_CONFIG

dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
dnl -------------------------------------------------------------------
dnl Since: 0.18
dnl
dnl Check to see whether a particular set of modules exists. Similar to
dnl PKG_CHECK_MODULES(), but does not set variables or print errors.
dnl
dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
dnl only at the first occurence in configure.ac, so if the first place
dnl it's called might be skipped (such as if it is within an "if", you
dnl have to call PKG_CHECK_EXISTS manually
AC_DEFUN([PKG_CHECK_EXISTS],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
if test -n "$PKG_CONFIG" && \
AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
m4_default([$2], [:])
m4_ifvaln([$3], [else
$3])dnl
fi])

dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
dnl ---------------------------------------------
dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
dnl pkg_failed based on the result.
m4_define([_PKG_CONFIG],
[if test -n "$$1"; then
pkg_cv_[]$1="$$1"
elif test -n "$PKG_CONFIG"; then
PKG_CHECK_EXISTS([$3],
[pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes ],
[pkg_failed=yes])
else
pkg_failed=untried
fi[]dnl
])dnl _PKG_CONFIG

dnl _PKG_SHORT_ERRORS_SUPPORTED
dnl ---------------------------
dnl Internal check to see if pkg-config supports short errors.
AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
_pkg_short_errors_supported=yes
else
_pkg_short_errors_supported=no
fi[]dnl
])dnl _PKG_SHORT_ERRORS_SUPPORTED


dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
dnl [ACTION-IF-NOT-FOUND])
dnl --------------------------------------------------------------
dnl Since: 0.4.0
dnl
dnl Note that if there is a possibility the first call to
dnl PKG_CHECK_MODULES might not happen, you should be sure to include an
dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
AC_DEFUN([PKG_CHECK_MODULES],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl

pkg_failed=no
AC_MSG_CHECKING([for $2])

_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
_PKG_CONFIG([$1][_LIBS], [libs], [$2])

m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
and $1[]_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.])

if test $pkg_failed = yes; then
AC_MSG_RESULT([no])
_PKG_SHORT_ERRORS_SUPPORTED
if test $_pkg_short_errors_supported = yes; then
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
else
$1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD

m4_default([$4], [AC_MSG_ERROR(
[Package requirements ($2) were not met:

$$1_PKG_ERRORS

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

_PKG_TEXT])[]dnl
])
elif test $pkg_failed = untried; then
AC_MSG_RESULT([no])
m4_default([$4], [AC_MSG_FAILURE(
[The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.

_PKG_TEXT

To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
])
else
$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
AC_MSG_RESULT([yes])
$3
fi[]dnl
])dnl PKG_CHECK_MODULES


dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
dnl [ACTION-IF-NOT-FOUND])
dnl ---------------------------------------------------------------------
dnl Since: 0.29
dnl
dnl Checks for existence of MODULES and gathers its build flags with
dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
dnl and VARIABLE-PREFIX_LIBS from --libs.
dnl
dnl Note that if there is a possibility the first call to
dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
dnl include an explicit call to PKG_PROG_PKG_CONFIG in your
dnl configure.ac.
AC_DEFUN([PKG_CHECK_MODULES_STATIC],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
_save_PKG_CONFIG=$PKG_CONFIG
PKG_CONFIG="$PKG_CONFIG --static"
PKG_CHECK_MODULES($@)
PKG_CONFIG=$_save_PKG_CONFIG[]dnl
])dnl PKG_CHECK_MODULES_STATIC


dnl PKG_INSTALLDIR([DIRECTORY])
dnl -------------------------
dnl Since: 0.27
dnl
dnl Substitutes the variable pkgconfigdir as the location where a module
dnl should install pkg-config .pc files. By default the directory is
dnl $libdir/pkgconfig, but the default can be changed by passing
dnl DIRECTORY. The user can override through the --with-pkgconfigdir
dnl parameter.
AC_DEFUN([PKG_INSTALLDIR],
[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
m4_pushdef([pkg_description],
[pkg-config installation directory @<:@]pkg_default[@:>@])
AC_ARG_WITH([pkgconfigdir],
[AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
[with_pkgconfigdir=]pkg_default)
AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
m4_popdef([pkg_default])
m4_popdef([pkg_description])
])dnl PKG_INSTALLDIR


dnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
dnl --------------------------------
dnl Since: 0.27
dnl
dnl Substitutes the variable noarch_pkgconfigdir as the location where a
dnl module should install arch-independent pkg-config .pc files. By
dnl default the directory is $datadir/pkgconfig, but the default can be
dnl changed by passing DIRECTORY. The user can override through the
dnl --with-noarch-pkgconfigdir parameter.
AC_DEFUN([PKG_NOARCH_INSTALLDIR],
[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
m4_pushdef([pkg_description],
[pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
AC_ARG_WITH([noarch-pkgconfigdir],
[AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
[with_noarch_pkgconfigdir=]pkg_default)
AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
m4_popdef([pkg_default])
m4_popdef([pkg_description])
])dnl PKG_NOARCH_INSTALLDIR


dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
dnl -------------------------------------------
dnl Since: 0.28
dnl
dnl Retrieves the value of the pkg-config variable for the given module.
AC_DEFUN([PKG_CHECK_VAR],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl

_PKG_CONFIG([$1], [variable="][$3]["], [$2])
AS_VAR_COPY([$1], [pkg_cv_][$1])

AS_VAR_IF([$1], [""], [$5], [$4])dnl
])dnl PKG_CHECK_VAR

+ 478
- 472
m4/python.m4
File diff suppressed because it is too large
View File


+ 81
- 4
runtests.sh View File

@@ -1,7 +1,7 @@
#!/bin/bash
# Script that runs the tests
#
# Version: 20161018
# Version: 20170826

EXIT_SUCCESS=0;
EXIT_FAILURE=1;
@@ -52,7 +52,7 @@ run_configure_make_check()
return ${RESULT};
fi

make check;
make check CHECK_WITH_STDERR=1;
RESULT=$?;

if test ${RESULT} -ne ${EXIT_SUCCESS};
@@ -69,6 +69,64 @@ run_configure_make_check()
return ${EXIT_SUCCESS};
}

run_configure_make_check_with_asan()
{
local LDCONFIG=`which ldconfig 2> /dev/null`;

if test -z ${LDCONFIG} || test ! -x ${LDCONFIG};
then
return ${EXIT_SUCCESS};
fi
local LIBASAN=`ldconfig -p | grep libasan | sed 's/^.* => //'`;

if test -z ${LIBASAN} || test ! -f ${LIBASAN};
then
return ${EXIT_SUCCESS};
fi
# Using libasan is platform dependent.
if test ${LIBASAN} != "/lib64/libasan.so.4";
then
return ${EXIT_SUCCESS};
fi

export CPPFLAGS="-DHAVE_ASAN";
export CFLAGS="-fno-omit-frame-pointer -fsanitize=address -g";
export LDFLAGS="-fsanitize=address -g";

if test -z ${CC} || test ${CC} != "clang";
then
LDFLAGS="${LDFLAGS} -lasan";
fi

run_configure_make $@;
RESULT=$?;

export CPPFLAGS=;
export CFLAGS=;
export LDFLAGS=;

if test ${RESULT} -ne ${EXIT_SUCCESS};
then
return ${RESULT};
fi

make check CHECK_WITH_ASAN=1 CHECK_WITH_STDERR=1;
RESULT=$?;

if test ${RESULT} -ne ${EXIT_SUCCESS};
then
echo "Running: 'make check' failed";

if test -f tests/test-suite.log;
then
cat tests/test-suite.log;
fi

return ${RESULT};
fi
return ${RESULT};
}

run_configure_make_check_with_coverage()
{
# Disable optimization so we can hook malloc and realloc.
@@ -97,7 +155,7 @@ run_configure_make_check_python()
return ${RESULT};
fi

make check SKIP_LIBRARY_TESTS=1 SKIP_TOOLS_TESTS=1;
make check CHECK_WITH_STDERR=1 SKIP_LIBRARY_TESTS=1 SKIP_TOOLS_TESTS=1;
RESULT=$?;

if test ${RESULT} -ne ${EXIT_SUCCESS};
@@ -180,7 +238,9 @@ fi

HAVE_ENABLE_PYTHON=$?;

if test ${HAVE_ENABLE_PYTHON} -eq 0;
PYTHON_CONFIG=`whereis python-config | sed 's/^.*:[ ]*//' 2> /dev/null`;

if test ${HAVE_ENABLE_PYTHON} -eq 0 && test -n "${PYTHON_CONFIG}";
then
# Test with Python 2.
PYTHON2=`which python2 2> /dev/null`;
@@ -264,6 +324,23 @@ then
fi
fi

if test ${HAVE_ENABLE_PYTHON} -eq 0 && test -n "${PYTHON_CONFIG}";
then
# Issue with running the python bindings with asan disabled for now.
# CONFIGURE_OPTIONS="--enable-python";
CONFIGURE_OPTIONS="";
else
CONFIGURE_OPTIONS="";
fi

run_configure_make_check_with_asan ${CONFIGURE_OPTIONS};
RESULT=$?;

if test ${RESULT} -ne ${EXIT_SUCCESS};
then
exit ${EXIT_FAILURE};
fi

run_configure_make_check_with_coverage;
RESULT=$?;



+ 6
- 1
synclibs.ps1 View File

@@ -1,6 +1,6 @@
# Script that synchronizes the local library dependencies
#
# Version: 20161110
# Version: 20170722

$GitUrlPrefix = "https://github.com/libyal"
$LocalLibs = "libbfio libcdata libcerror libcfile libclocale libcnotify libcpath libcsplit libcthreads libfcache libfdata libfdatetime libfguid libfmapi libfvalue libfwnt libuna"
@@ -12,6 +12,11 @@ $WinBison = "..\win_flex_bison\win_bison.exe"

ForEach (${LocalLib} in ${LocalLibs})
{
# Split will return an array of a single empty string when LocalLibs is empty.
If (-Not (${LocalLib}))
{
Continue
}
# PowerShell will raise NativeCommandError if git writes to stdout or stderr
# therefore 2>&1 is added and the output is stored in a variable.
$Output = Invoke-Expression -Command "${Git} clone ${GitUrlPrefix}/${LocalLib}.git ${LocalLib}-${pid} 2>&1"


+ 1
- 0
tests/lsan.suppressions View File

@@ -0,0 +1 @@
leak:/lib*/libpython*

+ 4
- 4
tests/pff_test_attached_file_io_handle.c View File

@@ -35,7 +35,7 @@

#include "../libpff/libpff_attached_file_io_handle.h"

#if defined( __GNUC__ )
#if defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT )

/* Tests the libpff_attached_file_io_handle_free function
* Returns 1 if successful or 0 if not
@@ -75,7 +75,7 @@ on_error:
return( 0 );
}

#endif /* defined( __GNUC__ ) */
#endif /* defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT ) */

/* The main program
*/
@@ -92,7 +92,7 @@ int main(
PFF_TEST_UNREFERENCED_PARAMETER( argc )
PFF_TEST_UNREFERENCED_PARAMETER( argv )

#if defined( __GNUC__ )
#if defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT )

/* TODO: add tests for libpff_attached_file_io_handle_initialize */

@@ -119,7 +119,7 @@ int main(
/* TODO: add tests for libpff_attached_file_io_handle_get_size */


#endif /* defined( __GNUC__ ) */
#endif /* defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT ) */

return( EXIT_SUCCESS );



+ 4
- 4
tests/pff_test_column_definition.c View File

@@ -35,7 +35,7 @@

#include "../libpff/libpff_column_definition.h"

#if defined( __GNUC__ )
#if defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT )

/* Tests the libpff_column_definition_initialize function
* Returns 1 if successful or 0 if not
@@ -270,7 +270,7 @@ on_error:
return( 0 );
}

#endif /* defined( __GNUC__ ) */
#endif /* defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT ) */

/* The main program
*/
@@ -287,7 +287,7 @@ int main(
PFF_TEST_UNREFERENCED_PARAMETER( argc )
PFF_TEST_UNREFERENCED_PARAMETER( argv )

#if defined( __GNUC__ )
#if defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT )

PFF_TEST_RUN(
"libpff_column_definition_initialize",
@@ -297,7 +297,7 @@ int main(
"libpff_column_definition_free",
pff_test_column_definition_free );

#endif /* defined( __GNUC__ ) */
#endif /* defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT ) */

return( EXIT_SUCCESS );



+ 4
- 4
tests/pff_test_data_array.c View File

@@ -35,7 +35,7 @@

#include "../libpff/libpff_data_array.h"

#if defined( __GNUC__ )
#if defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT )

/* Tests the libpff_data_array_free function
* Returns 1 if successful or 0 if not
@@ -75,7 +75,7 @@ on_error:
return( 0 );
}

#endif /* defined( __GNUC__ ) */
#endif /* defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT ) */

/* The main program
*/
@@ -92,7 +92,7 @@ int main(
PFF_TEST_UNREFERENCED_PARAMETER( argc )
PFF_TEST_UNREFERENCED_PARAMETER( argv )

#if defined( __GNUC__ )
#if defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT )

/* TODO: add tests for libpff_data_array_initialize */

@@ -110,7 +110,7 @@ int main(

/* TODO: add tests for libpff_data_array_decrypt_entry_data */

#endif /* defined( __GNUC__ ) */
#endif /* defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT ) */

return( EXIT_SUCCESS );



+ 4
- 4
tests/pff_test_data_array_entry.c View File

@@ -35,7 +35,7 @@

#include "../libpff/libpff_data_array_entry.h"

#if defined( __GNUC__ )
#if defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT )

/* Tests the libpff_data_array_entry_initialize function
* Returns 1 if successful or 0 if not
@@ -416,7 +416,7 @@ on_error:
return( 0 );
}

#endif /* defined( __GNUC__ ) */
#endif /* defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT ) */

/* The main program
*/
@@ -433,7 +433,7 @@ int main(
PFF_TEST_UNREFERENCED_PARAMETER( argc )
PFF_TEST_UNREFERENCED_PARAMETER( argv )

#if defined( __GNUC__ )
#if defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT )

PFF_TEST_RUN(
"libpff_data_array_entry_initialize",
@@ -447,7 +447,7 @@ int main(
"libpff_data_array_entry_clone",
pff_test_data_array_entry_clone );

#endif /* defined( __GNUC__ ) */
#endif /* defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT ) */

return( EXIT_SUCCESS );



+ 4
- 4
tests/pff_test_data_block.c View File

@@ -35,7 +35,7 @@

#include "../libpff/libpff_data_block.h"

#if defined( __GNUC__ )
#if defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT )

/* Tests the libpff_data_block_free function
* Returns 1 if successful or 0 if not
@@ -75,7 +75,7 @@ on_error:
return( 0 );
}

#endif /* defined( __GNUC__ ) */
#endif /* defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT ) */

/* The main program
*/
@@ -92,7 +92,7 @@ int main(
PFF_TEST_UNREFERENCED_PARAMETER( argc )
PFF_TEST_UNREFERENCED_PARAMETER( argv )

#if defined( __GNUC__ )
#if defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT )

/* TODO: add tests for libpff_data_block_initialize */

@@ -108,7 +108,7 @@ int main(

/* TODO: add tests for libpff_data_block_decrypt_data */

#endif /* defined( __GNUC__ ) */
#endif /* defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT ) */

return( EXIT_SUCCESS );



+ 4
- 4
tests/pff_test_deflate.c View File

@@ -207,7 +207,7 @@ uint8_t pff_test_deflate_compressed_byte_stream[ 2627 ] = {
0x7d, 0x8a, 0x87, 0xf9, 0x9d, 0x74, 0x33, 0x0e, 0x79, 0xc5, 0xf8, 0x73, 0xcd, 0xff, 0x00, 0x30,
0x4a, 0x56, 0xa4 };

#if defined( __GNUC__ )
#if defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT )

/* Tests the libpff_deflate_decompress function
* Returns 1 if successful or 0 if not
@@ -324,7 +324,7 @@ on_error:
return( 0 );
}

#endif /* defined( __GNUC__ ) */
#endif /* defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT ) */

/* The main program
*/
@@ -350,7 +350,7 @@ int main(
NULL );
#endif

#if defined( __GNUC__ )
#if defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT )

/* TODO add tests for libpff_deflate_bit_stream_get_value */

@@ -366,7 +366,7 @@ int main(
"libpff_deflate_decompress",
pff_test_deflate_decompress );

#endif /* defined( __GNUC__ ) */
#endif /* defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT ) */

return( EXIT_SUCCESS );



+ 4
- 4
tests/pff_test_descriptors_index.c View File

@@ -35,7 +35,7 @@

#include "../libpff/libpff_descriptors_index.h"

#if defined( __GNUC__ )
#if defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT )

/* Tests the libpff_descriptors_index_free function
* Returns 1 if successful or 0 if not
@@ -75,7 +75,7 @@ on_error:
return( 0 );
}

#endif /* defined( __GNUC__ ) */
#endif /* defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT ) */

/* The main program
*/
@@ -92,7 +92,7 @@ int main(
PFF_TEST_UNREFERENCED_PARAMETER( argc )
PFF_TEST_UNREFERENCED_PARAMETER( argv )

#if defined( __GNUC__ )
#if defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT )

/* TODO: add tests for libpff_descriptors_index_initialize */

@@ -104,7 +104,7 @@ int main(

/* TODO: add tests for libpff_descriptors_index_get_index_value_by_identifier */

#endif /* defined( __GNUC__ ) */
#endif /* defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT ) */

return( EXIT_SUCCESS );



+ 2
- 2
tests/pff_test_file.c View File

@@ -2525,13 +2525,13 @@ int main(
pff_test_file_signal_abort,
file );

#if defined( __GNUC__ )
#if defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT )

/* TODO: add tests for libpff_file_open_read */

/* TODO: add tests for libpff_file_read_allocation_tables */

#endif /* defined( __GNUC__ ) */
#endif /* defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT ) */

/* TODO: add tests for libpff_file_is_corrupted */



+ 2
- 2
tests/pff_test_folder.c View File

@@ -58,7 +58,7 @@ int main(

/* TODO: add tests for libpff_folder_get_utf16_name */

#if defined( __GNUC__ )
#if defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT )

/* TODO: add tests for libpff_folder_determine_sub_folders */

@@ -68,7 +68,7 @@ int main(

/* TODO: add tests for libpff_folder_determine_unknowns */

#endif /* defined( __GNUC__ ) */
#endif /* defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT ) */

/* TODO: add tests for libpff_folder_get_number_of_sub_folders */



+ 4
- 4
tests/pff_test_index.c View File

@@ -35,7 +35,7 @@

#include "../libpff/libpff_index.h"

#if defined( __GNUC__ )
#if defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT )

/* Tests the libpff_index_free function
* Returns 1 if successful or 0 if not
@@ -75,7 +75,7 @@ on_error:
return( 0 );
}

#endif /* defined( __GNUC__ ) */
#endif /* defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT ) */

/* The main program
*/
@@ -92,7 +92,7 @@ int main(
PFF_TEST_UNREFERENCED_PARAMETER( argc )
PFF_TEST_UNREFERENCED_PARAMETER( argv )

#if defined( __GNUC__ )
#if defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT )

/* TODO: add tests for libpff_index_initialize */

@@ -110,7 +110,7 @@ int main(

/* TODO: add tests for libpff_index_read_sub_nodes */

#endif /* defined( __GNUC__ ) */
#endif /* defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT ) */

return( EXIT_SUCCESS );



+ 4
- 4
tests/pff_test_index_node.c View File

@@ -35,7 +35,7 @@

#include "../libpff/libpff_index_node.h"

#if defined( __GNUC__ )
#if defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT )

/* Tests the libpff_index_node_initialize function
* Returns 1 if successful or 0 if not
@@ -270,7 +270,7 @@ on_error:
return( 0 );
}

#endif /* defined( __GNUC__ ) */
#endif /* defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT ) */

/* The main program
*/
@@ -287,7 +287,7 @@ int main(
PFF_TEST_UNREFERENCED_PARAMETER( argc )
PFF_TEST_UNREFERENCED_PARAMETER( argv )

#if defined( __GNUC__ )
#if defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT )

PFF_TEST_RUN(
"libpff_index_node_initialize",
@@ -303,7 +303,7 @@ int main(

/* TODO: add tests for libpff_index_node_check_for_empty_block */

#endif /* defined( __GNUC__ ) */
#endif /* defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT ) */

return( EXIT_SUCCESS );



+ 4
- 4
tests/pff_test_index_value.c View File

@@ -36,7 +36,7 @@

#include "../libpff/libpff_index_value.h"

#if defined( __GNUC__ )
#if defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT )

/* Tests the libpff_index_value_initialize function
* Returns 1 if successful or 0 if not
@@ -429,7 +429,7 @@ on_error:
return( 0 );
}

#endif /* defined( __GNUC__ ) */
#endif /* defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT ) */

/* The main program
*/
@@ -446,7 +446,7 @@ int main(
PFF_TEST_UNREFERENCED_PARAMETER( argc )
PFF_TEST_UNREFERENCED_PARAMETER( argv )

#if defined( __GNUC__ )
#if defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT )

PFF_TEST_RUN(
"libpff_index_value_initialize",
@@ -460,7 +460,7 @@ int main(
"libpff_index_value_compare",
pff_test_index_value_compare );

#endif /* defined( __GNUC__ ) */
#endif /* defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT ) */

return( EXIT_SUCCESS );



+ 4
- 4
tests/pff_test_io_handle.c View File

@@ -35,7 +35,7 @@

#include "../libpff/libpff_io_handle.h"

#if defined( __GNUC__ )
#if defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT )

/* Tests the libpff_io_handle_initialize function
* Returns 1 if successful or 0 if not
@@ -270,7 +270,7 @@ on_error:
return( 0 );
}

#endif /* defined( __GNUC__ ) */
#endif /* defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT ) */

/* The main program
*/
@@ -287,7 +287,7 @@ int main(
PFF_TEST_UNREFERENCED_PARAMETER( argc )
PFF_TEST_UNREFERENCED_PARAMETER( argv )

#if defined( __GNUC__ )
#if defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT )

PFF_TEST_RUN(
"libpff_io_handle_initialize",
@@ -307,7 +307,7 @@ int main(

/* TODO: add tests for libpff_io_handle_read_index_node */

#endif /* defined( __GNUC__ ) */
#endif /* defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT ) */

return( EXIT_SUCCESS );



+ 6
- 6
tests/pff_test_item.c View File

@@ -73,9 +73,9 @@ on_error:
return( 0 );
}

#if defined( __GNUC__ )
#if defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT )

#endif /* defined( __GNUC__ ) */
#endif /* defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT ) */

/* The main program
*/
@@ -92,17 +92,17 @@ int main(
PFF_TEST_UNREFERENCED_PARAMETER( argc )
PFF_TEST_UNREFERENCED_PARAMETER( argv )

#if defined( __GNUC__ )
#if defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT )

/* TODO: add tests for libpff_item_initialize */

#endif /* defined( __GNUC__ ) */
#endif /* defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT ) */

PFF_TEST_RUN(
"libpff_item_free",
pff_test_item_free );

#if defined( __GNUC__ )
#if defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT )

/* TODO: add tests for libpff_item_clone */

@@ -124,7 +124,7 @@ int main(

/* TODO: add tests for libpff_item_get_sub_item_by_identifier */

#endif /* defined( __GNUC__ ) */
#endif /* defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT ) */

return( EXIT_SUCCESS );



+ 4
- 4
tests/pff_test_item_descriptor.c View File

@@ -35,7 +35,7 @@

#include "../libpff/libpff_item_descriptor.h"

#if defined( __GNUC__ )
#if defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT )

/* Tests the libpff_item_descriptor_free function
* Returns 1 if successful or 0 if not
@@ -75,7 +75,7 @@ on_error:
return( 0 );
}

#endif /* defined( __GNUC__ ) */
#endif /* defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT ) */

/* The main program
*/
@@ -92,7 +92,7 @@ int main(
PFF_TEST_UNREFERENCED_PARAMETER( argc )
PFF_TEST_UNREFERENCED_PARAMETER( argv )

#if defined( __GNUC__ )
#if defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT )

/* TODO: add tests for libpff_item_descriptor_initialize */

@@ -104,7 +104,7 @@ int main(

/* TODO: add tests for libpff_item_descriptor_compare */

#endif /* defined( __GNUC__ ) */
#endif /* defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT ) */

return( EXIT_SUCCESS );



+ 4
- 4
tests/pff_test_item_values.c View File

@@ -35,7 +35,7 @@

#include "../libpff/libpff_item_values.h"

#if defined( __GNUC__ )
#if defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT )

/* Tests the libpff_item_values_free function
* Returns 1 if successful or 0 if not
@@ -75,7 +75,7 @@ on_error:
return( 0 );
}

#endif /* defined( __GNUC__ ) */
#endif /* defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT ) */

/* The main program
*/
@@ -92,7 +92,7 @@ int main(
PFF_TEST_UNREFERENCED_PARAMETER( argc )
PFF_TEST_UNREFERENCED_PARAMETER( argv )

#if defined( __GNUC__ )
#if defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT )

/* TODO: add tests for libpff_item_values_initialize */

@@ -116,7 +116,7 @@ int main(

/* TODO: add tests for libpff_item_values_get_record_entry_by_utf16_name */

#endif /* defined( __GNUC__ ) */
#endif /* defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT ) */

return( EXIT_SUCCESS );



+ 4
- 4
tests/pff_test_local_descriptor_node.c View File

@@ -35,7 +35,7 @@

#include "../libpff/libpff_local_descriptor_node.h"

#if defined( __GNUC__ )
#if defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT )

/* Tests the libpff_local_descriptor_node_initialize function
* Returns 1 if successful or 0 if not
@@ -270,7 +270,7 @@ on_error:
return( 0 );
}

#endif /* defined( __GNUC__ ) */
#endif /* defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT ) */

/* The main program
*/
@@ -287,7 +287,7 @@ int main(
PFF_TEST_UNREFERENCED_PARAMETER( argc )
PFF_TEST_UNREFERENCED_PARAMETER( argv )

#if defined( __GNUC__ )
#if defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT )

PFF_TEST_RUN(
"libpff_local_descriptor_node_initialize",
@@ -307,7 +307,7 @@ int main(

/* TODO: add tests for libpff_local_descriptor_node_read_element_data */

#endif /* defined( __GNUC__ ) */
#endif /* defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT ) */

return( EXIT_SUCCESS );



+ 4
- 4
tests/pff_test_local_descriptor_value.c View File

@@ -35,7 +35,7 @@

#include "../libpff/libpff_local_descriptor_value.h"

#if defined( __GNUC__ )
#if defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT )

/* Tests the libpff_local_descriptor_value_initialize function
* Returns 1 if successful or 0 if not
@@ -416,7 +416,7 @@ on_error:
return( 0 );
}

#endif /* defined( __GNUC__ ) */
#endif /* defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT ) */

/* The main program
*/
@@ -433,7 +433,7 @@ int main(
PFF_TEST_UNREFERENCED_PARAMETER( argc )
PFF_TEST_UNREFERENCED_PARAMETER( argv )

#if defined( __GNUC__ )
#if defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT )

PFF_TEST_RUN(
"libpff_local_descriptor_value_initialize",
@@ -447,7 +447,7 @@ int main(
"libpff_local_descriptor_value_clone",
pff_test_local_descriptor_value_clone );

#endif /* defined( __GNUC__ ) */
#endif /* defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT ) */

return( EXIT_SUCCESS );



+ 4
- 4
tests/pff_test_local_descriptors.c View File

@@ -35,7 +35,7 @@

#include "../libpff/libpff_local_descriptors.h"

#if defined( __GNUC__ )
#if defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT )

/* Tests the libpff_local_descriptors_free function
* Returns 1 if successful or 0 if not
@@ -75,7 +75,7 @@ on_error:
return( 0 );
}

#endif /* defined( __GNUC__ ) */
#endif /* defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT ) */

/* The main program
*/
@@ -92,7 +92,7 @@ int main(
PFF_TEST_UNREFERENCED_PARAMETER( argc )
PFF_TEST_UNREFERENCED_PARAMETER( argv )

#if defined( __GNUC__ )
#if defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT )

/* TODO: add tests for libpff_local_descriptors_initialize */

@@ -112,7 +112,7 @@ int main(

/* TODO: add tests for libpff_local_descriptors_read_sub_nodes */

#endif /* defined( __GNUC__ ) */
#endif /* defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT ) */

return( EXIT_SUCCESS );



+ 5
- 3
tests/pff_test_memory.c View File

@@ -25,13 +25,15 @@
#include <stdlib.h>
#endif

#if defined( HAVE_GNU_DL_DLSYM ) && defined( __GNUC__ ) && !defined( __clang__ )
#if defined( HAVE_GNU_DL_DLSYM ) && defined( __GNUC__ )
#define __USE_GNU
#include <dlfcn.h>
#undef __USE_GNU
#endif

#if defined( HAVE_GNU_DL_DLSYM ) && defined( __GNUC__ ) && !defined( __clang__ )
#include "pff_test_memory.h"

#if defined( HAVE_PFF_TEST_MEMORY )

static void *(*pff_test_real_malloc)(size_t) = NULL;
static void *(*pff_test_real_memcpy)(void *, void *, size_t) = NULL;
@@ -171,5 +173,5 @@ void *realloc(
return( ptr );
}

#endif /* defined( HAVE_GNU_DL_DLSYM ) && defined( __GNUC__ ) && !defined( __clang__ ) */
#endif /* defined( HAVE_PFF_TEST_MEMORY ) */


+ 1
- 1
tests/pff_test_memory.h View File

@@ -28,7 +28,7 @@
extern "C" {
#endif

#if defined( HAVE_GNU_DL_DLSYM ) && defined( __GNUC__ ) && !defined( __clang__ ) && !defined( __arm__ ) && !defined( __mips__ ) && !defined( __hppa__ ) && !defined( __sparc__ )
#if defined( HAVE_GNU_DL_DLSYM ) && defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT ) && !defined( __arm__ ) && !defined( __clang__ ) && !defined( __CYGWIN__ ) && !defined( __hppa__ ) && !defined( __mips__ ) && !defined( __sparc__ ) && !defined( HAVE_ASAN )
#define HAVE_PFF_TEST_MEMORY 1
#endif



+ 6
- 6
tests/pff_test_message.c View File

@@ -48,13 +48,13 @@ int main(
PFF_TEST_UNREFERENCED_PARAMETER( argc )
PFF_TEST_UNREFERENCED_PARAMETER( argv )

#if defined( __GNUC__ )
#if defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT )

/* TODO: add tests for libpff_message_initialize_sub_item_attachments */

/* TODO: add tests for libpff_message_initialize_sub_item_recipients */

#endif /* defined( __GNUC__ ) */
#endif /* defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT ) */

/* TODO: add tests for libpff_message_get_entry_value_utf8_string_size */

@@ -72,13 +72,13 @@ int main(

/* TODO: add tests for libpff_message_get_modification_time */

#if defined( __GNUC__ )
#if defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT )

/* TODO: add tests for libpff_message_determine_attachment */

/* TODO: add tests for libpff_message_determine_attachments */

#endif /* defined( __GNUC__ ) */
#endif /* defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT ) */

/* TODO: add tests for libpff_message_get_number_of_attachments */

@@ -86,11 +86,11 @@ int main(

/* TODO: add tests for libpff_message_get_attachments */

#if defined( __GNUC__ )
#if defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT )

/* TODO: add tests for libpff_message_determine_recipients */

#endif /* defined( __GNUC__ ) */
#endif /* defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT ) */

/* TODO: add tests for libpff_message_get_recipients */



+ 8
- 8
tests/pff_test_multi_value.c View File

@@ -35,7 +35,7 @@

#include "../libpff/libpff_multi_value.h"

#if defined( __GNUC__ )
#if defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT )

/* Tests the libpff_multi_value_initialize function
* Returns 1 if successful or 0 if not
@@ -232,7 +232,7 @@ on_error:
return( 0 );
}

#endif /* defined( __GNUC__ ) */
#endif /* defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT ) */

/* Tests the libpff_multi_value_free function
* Returns 1 if successful or 0 if not
@@ -272,7 +272,7 @@ on_error:
return( 0 );
}

#if defined( __GNUC__ )
#if defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT )

/* Tests the libpff_multi_value_get_number_of_values function
* Returns 1 if successful or 0 if not
@@ -397,7 +397,7 @@ on_error:
return( 0 );
}

#endif /* defined( __GNUC__ ) */
#endif /* defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT ) */

/* The main program
*/
@@ -414,25 +414,25 @@ int main(
PFF_TEST_UNREFERENCED_PARAMETER( argc )
PFF_TEST_UNREFERENCED_PARAMETER( argv )

#if defined( __GNUC__ )
#if defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT )

PFF_TEST_RUN(
"libpff_multi_value_initialize",
pff_test_multi_value_initialize );

#endif /* defined( __GNUC__ ) */
#endif /* defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT ) */

PFF_TEST_RUN(
"libpff_multi_value_free",
pff_test_multi_value_free );

#if defined( __GNUC__ )
#if defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT )

PFF_TEST_RUN(
"libpff_multi_value_get_number_of_values",
pff_test_multi_value_get_number_of_values );

#endif /* defined( __GNUC__ ) */
#endif /* defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT ) */

/* TODO: add tests for libpff_multi_value_get_value */



+ 4
- 4
tests/pff_test_offsets_index.c View File

@@ -35,7 +35,7 @@

#include "../libpff/libpff_offsets_index.h"

#if defined( __GNUC__ )
#if defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT )

/* Tests the libpff_offsets_index_free function
* Returns 1 if successful or 0 if not
@@ -75,7 +75,7 @@ on_error:
return( 0 );
}

#endif /* defined( __GNUC__ ) */
#endif /* defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT ) */

/* The main program
*/
@@ -92,7 +92,7 @@ int main(
PFF_TEST_UNREFERENCED_PARAMETER( argc )
PFF_TEST_UNREFERENCED_PARAMETER( argv )

#if defined( __GNUC__ )
#if defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT )

/* TODO: add tests for libpff_offsets_index_initialize */

@@ -104,7 +104,7 @@ int main(

/* TODO: add tests for libpff_offsets_index_get_index_value_by_identifier */

#endif /* defined( __GNUC__ ) */
#endif /* defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT ) */

return( EXIT_SUCCESS );



+ 18
- 2
tests/pff_test_read_items.c View File

@@ -64,7 +64,7 @@ int pff_test_read_items(
stderr,
"Unable to retrieve display name size.\n" );

return( -1 );
goto on_error;
}
if( libpff_item_get_number_of_sub_items(
item,
@@ -75,7 +75,7 @@ int pff_test_read_items(
stderr,
"Unable to retrieve number of sub items.\n" );

return( -1 );
goto on_error;
}
for( sub_item_index = 0;
sub_item_index < number_of_sub_items;
@@ -193,6 +193,16 @@ int main( int argc, char * const argv[] )

goto on_error;
}
if( libpff_item_free(
&item,
&error ) != 1 )
{
fprintf(
stderr,
"Unable to free item.\n" );

goto on_error;
}
if( libpff_file_recover_items(
file,
0,
@@ -251,6 +261,12 @@ on_error:
libpff_error_free(
&error );
}
if( item != NULL )
{
libpff_item_free(
&item,
NULL );
}
if( file != NULL )
{
libpff_file_close(


+ 16
- 16
tests/pff_test_record_entry.c View File

@@ -35,7 +35,7 @@

#include "../libpff/libpff_record_entry.h"

#if defined( __GNUC__ )
#if defined( __GNUC__ ) && !defined( LIBPFF_DLL_IMPORT )

/* Tests the libpff_record_entry_initialize function
* Returns 1 if successful or 0 if not
@@ -73,8 +73,8 @@ int pff_test_record_entry_initialize(
"error",
error );

result = libpff_record_entry_free(
&record_entry,
result = libpff_internal_record_entry_free(
(libpff_internal_record_entry_t **) &record_entry,
&error );

PFF_TEST_ASSERT_EQUAL_INT(
@@ -151,8 +151,8 @@ int pff_test_record_entry_initialize(

if( record_entry != NULL )
{
libpff_record_entry_free(
&record_entry,
libpff_internal_record_entry_free(
(libpff_internal_record_entry_t **) &record_entry,
NULL );
}
}
@@ -194,8 +194,8 @@ int pff_test_record_entry_initialize(

if( record_entry != NULL )
{
libpff_record_entry_free(
&record_entry,
libpff_internal_record_entry_free(
(libpff_internal_record_entry_t **) &record_entry,
NULL );
}
}
@@ -230,14 +230,14 @@ on_error:
}
if( record_entry != NULL )
{
libpff_record_entry_free(
&record_entry,