Skip to content

Commit

Permalink
Changes for CI tests
Browse files Browse the repository at this point in the history
  • Loading branch information
joachimmetz committed Oct 16, 2023
1 parent 0399793 commit 8c502af
Show file tree
Hide file tree
Showing 13 changed files with 241 additions and 247 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/build_wheel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Build wheel from source using tox.
name: build_wheel
on: [push, pull_request]
permissions: read-all
jobs:
build_wheel:
runs-on: ubuntu-22.04
strategy:
matrix:
include:
- python-version: '3.7'
toxenv: 'py37'
- python-version: '3.8'
toxenv: 'py38'
- python-version: '3.9'
toxenv: 'py39'
- python-version: '3.10'
toxenv: 'py310'
- python-version: '3.11'
toxenv: 'py311'
- python-version: '3.12'
toxenv: 'py312'
steps:
- uses: actions/checkout@v3
- name: Install build dependencies
run: |
sudo add-apt-repository universe &&
sudo add-apt-repository -y ppa:deadsnakes/ppa &&
sudo apt-get update &&
sudo apt-get install -y autoconf automake autopoint build-essential git libtool pkg-config python${{ matrix.python-version }} python${{ matrix.python-version }}-dev python${{ matrix.python-version }}-venv python3-distutils python3-pip python3-setuptools
- name: Install tox
run: |
python3 -m pip install tox
- name: Download test data
run: |
if test -x "synctestdata.sh"; then ./synctestdata.sh; fi
- name: Prepare build
run: |
./synclibs.sh --use-head && ./autogen.sh && ./configure
- name: Build Python wheel
run: |
tox -e${{ matrix.toxenv }}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Files to ignore by git
#
# Version: 20230923
# Version: 20230926

# Generic auto-generated build files
*~
Expand All @@ -25,7 +25,9 @@
*.swp
*.Tpo
*.trs
*.whl
/*.egg-info/
__pycache__
.deps
.dirstamp
.libs
Expand Down
13 changes: 13 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,18 +92,24 @@ environment:
APPVEYOR_BUILD_WORKER_IMAGE: macos-monterey
HOMEBREW_NO_INSTALL_CLEANUP: 1
CC: clang
CFLAGS: "-I/usr/local/include"
LDFLAGS: "-L/usr/local/lib"
CONFIGURE_OPTIONS: ""
- TARGET: macos-x64-gcc
BUILD_ENVIRONMENT: xcode
APPVEYOR_BUILD_WORKER_IMAGE: macos-monterey
HOMEBREW_NO_INSTALL_CLEANUP: 1
CC: gcc
CFLAGS: "-I/usr/local/include"
LDFLAGS: "-L/usr/local/lib"
CONFIGURE_OPTIONS: ""
- TARGET: macos-x64-gcc-python
BUILD_ENVIRONMENT: xcode
APPVEYOR_BUILD_WORKER_IMAGE: macos-monterey
PYTHON: "/usr/local/opt/python@3.11/bin/python3"
PYTHON_CONFIG: "/usr/local/opt/python@3.11/bin/python3-config"
HOMEBREW_NO_INSTALL_CLEANUP: 1
CC: gcc
CFLAGS: "-I/usr/local/include"
LDFLAGS: "-L/usr/local/lib"
CONFIGURE_OPTIONS: "--enable-python"
Expand All @@ -113,6 +119,7 @@ environment:
PYTHON: "/usr/local/opt/python@3.11/bin/python3"
PYTHON_CONFIG: "/usr/local/opt/python@3.11/bin/python3-config"
HOMEBREW_NO_INSTALL_CLEANUP: 1
CC: gcc
CFLAGS: "-I/usr/local/include"
LDFLAGS: "-L/usr/local/lib"
CONFIGURE_OPTIONS: "--disable-dependency-tracking --prefix=/usr/local --enable-python --with-pyprefix"
Expand Down Expand Up @@ -148,6 +155,12 @@ environment:
HOMEBREW_NO_INSTALL_CLEANUP: 1
PYTHON_VERSION: 3.11
TOXENV: py311
- TARGET: macos-tox-py312
BUILD_ENVIRONMENT: python-tox
APPVEYOR_BUILD_WORKER_IMAGE: macos-monterey
HOMEBREW_NO_INSTALL_CLEANUP: 1
PYTHON_VERSION: 3.12
TOXENV: py312
- TARGET: cygwin64-gcc
BUILD_ENVIRONMENT: cygwin64
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ AC_PREREQ([2.71])

AC_INIT(
[libvhdi],
[20230925],
[20231016],
[joachim.metz@gmail.com])

AC_CONFIG_SRCDIR(
Expand Down
4 changes: 2 additions & 2 deletions libvhdi.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
<package >
<metadata>
<id>libvhdi</id>
<version>20230925</version>
<version>20231016</version>
<authors>Joachim Metz</authors>
<owners>joachimmetz</owners>
<license type="expression">LGPL-3.0-or-later</license>
<projectUrl>https://github.com/libyal/libvhdi</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<title>libvhdi</title>
<description>Library to access the Virtual Hard Disk (VHD) image format</description>
<releaseNotes>Release of libvhdi 20230925</releaseNotes>
<releaseNotes>Release of libvhdi 20231016</releaseNotes>
<copyright>Copyright (C) 2012-2023</copyright>
<tags>native</tags>
</metadata>
Expand Down
6 changes: 3 additions & 3 deletions pyvhdi/pyvhdi_file_object_io_handle.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,13 +232,13 @@ int pyvhdi_file_object_io_handle_free(
Py_DecRef(
( *file_object_io_handle )->file_object );

PyGILState_Release(
gil_state );

PyMem_Free(
*file_object_io_handle );

*file_object_io_handle = NULL;

PyGILState_Release(
gil_state );
}
return( 1 );
}
Expand Down
75 changes: 41 additions & 34 deletions tests/test_library.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#!/usr/bin/env bash
# Tests library functions and types.
#
# Version: 20230410
# Version: 20231007

EXIT_SUCCESS=0;
EXIT_FAILURE=1;
EXIT_IGNORE=77;

LIBRARY_TESTS="block_allocation_table block_descriptor checksum dynamic_disk_header error file_footer file_information image_header io_handle metadata_table metadata_table_entry metadata_table_header metadata_values notify parent_locator parent_locator_entry parent_locator_header region_table region_table_entry region_table_header sector_range_descriptor";
LIBRARY_TESTS_WITH_INPUT="file support";
OPTION_SETS="";
OPTION_SETS=();

INPUT_GLOB="*";

Expand Down Expand Up @@ -78,47 +78,54 @@ run_test_with_input()

local TEST_SET_DIRECTORY=$(get_test_set_directory "${TEST_PROFILE_DIRECTORY}" "${TEST_SET_INPUT_DIRECTORY}");

local OLDIFS=${IFS};

# IFS="\n" is not supported by all platforms.
IFS="
";

if test -f "${TEST_SET_DIRECTORY}/files";
then
for INPUT_FILE in `cat ${TEST_SET_DIRECTORY}/files | sed "s?^?${TEST_SET_INPUT_DIRECTORY}/?"`;
IFS="" read -a INPUT_FILES <<< $(cat ${TEST_SET_DIRECTORY}/files | sed "s?^?${TEST_SET_INPUT_DIRECTORY}/?");
else
IFS="" read -a INPUT_FILES <<< $(ls -1d ${TEST_SET_INPUT_DIRECTORY}/${INPUT_GLOB});
fi
for INPUT_FILE in "${INPUT_FILES[@]}";
do
OPTION_INPUT_FILE="${INPUT_FILE}";

if test "${OSTYPE}" = "msys";
then
# A test executable built with MinGW expects a Windows path.
INPUT_FILE=`echo ${INPUT_FILE} | sed 's?/?\\\\?g'`;
fi
local TESTED_WITH_OPTIONS=0;

for OPTION_SET in ${OPTION_SETS[@]};
do
if test "${OSTYPE}" = "msys";
then
# A test executable built with MinGW expects a Windows path.
INPUT_FILE=`echo ${INPUT_FILE} | sed 's?/?\\\\?g'`;
fi
run_test_on_input_file_with_options "${TEST_SET_DIRECTORY}" "${TEST_DESCRIPTION}" "default" "${OPTION_SETS}" "${TEST_EXECUTABLE}" "${INPUT_FILE}";
RESULT=$?;
local TEST_DATA_OPTION_FILE=$(get_test_data_option_file "${TEST_SET_DIRECTORY}" "${OPTION_INPUT_FILE}" "${OPTION_SET}");

if test ${RESULT} -ne ${EXIT_SUCCESS};
if test -f ${TEST_DATA_OPTION_FILE};
then
break;
TESTED_WITH_OPTIONS=1;

IFS=" " read -a OPTIONS <<< $(read_test_data_option_file "${TEST_SET_DIRECTORY}" "${INPUT_FILE}" "${OPTION_SET}");

run_test_on_input_file "${TEST_SET_DIRECTORY}" "${TEST_DESCRIPTION}" "default" "${OPTION_SET}" "${TEST_EXECUTABLE}" "${INPUT_FILE}" "${OPTIONS[@]}";
RESULT=$?;

if test ${RESULT} -ne ${EXIT_SUCCESS};
then
break;
fi
fi
done
else
for INPUT_FILE in `ls -1d ${TEST_SET_INPUT_DIRECTORY}/${INPUT_GLOB}`;
do
if test "${OSTYPE}" = "msys";
then
# A test executable built with MinGW expects a Windows path.
INPUT_FILE=`echo ${INPUT_FILE} | sed 's?/?\\\\?g'`;
fi
run_test_on_input_file_with_options "${TEST_SET_DIRECTORY}" "${TEST_DESCRIPTION}" "default" "${OPTION_SETS}" "${TEST_EXECUTABLE}" "${INPUT_FILE}";

if test ${TESTED_WITH_OPTIONS} -eq 0;
then
run_test_on_input_file "${TEST_SET_DIRECTORY}" "${TEST_DESCRIPTION}" "default" "" "${TEST_EXECUTABLE}" "${INPUT_FILE}";
RESULT=$?;
fi

if test ${RESULT} -ne ${EXIT_SUCCESS};
then
break;
fi
done
fi
IFS=${OLDIFS};
if test ${RESULT} -ne ${EXIT_SUCCESS};
then
break;
fi
done

if test ${RESULT} -ne ${EXIT_SUCCESS};
then
Expand Down
58 changes: 34 additions & 24 deletions tests/test_python_module.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#!/usr/bin/env bash
# Tests Python module functions and types.
#
# Version: 20230410
# Version: 20231005

EXIT_SUCCESS=0;
EXIT_FAILURE=1;
EXIT_IGNORE=77;

TEST_FUNCTIONS="support";
TEST_FUNCTIONS_WITH_INPUT="file";
OPTION_SETS="";
OPTION_SETS=();

TEST_TOOL_DIRECTORY=".";
INPUT_GLOB="*";
Expand Down Expand Up @@ -68,37 +68,47 @@ test_python_function_with_input()

local TEST_SET_DIRECTORY=$(get_test_set_directory "${TEST_PROFILE_DIRECTORY}" "${TEST_SET_INPUT_DIRECTORY}");

local OLDIFS=${IFS};

# IFS="\n"; is not supported by all platforms.
IFS="
";

if test -f "${TEST_SET_DIRECTORY}/files";
then
for INPUT_FILE in `cat ${TEST_SET_DIRECTORY}/files | sed "s?^?${TEST_SET_INPUT_DIRECTORY}/?"`;
IFS="" read -a INPUT_FILES <<< $(cat ${TEST_SET_DIRECTORY}/files | sed "s?^?${TEST_SET_INPUT_DIRECTORY}/?");
else
IFS="" read -a INPUT_FILES <<< $(ls -1d ${TEST_SET_INPUT_DIRECTORY}/${INPUT_GLOB});
fi
for INPUT_FILE in "${INPUT_FILES[@]}";
do
local TESTED_WITH_OPTIONS=0;

for OPTION_SET in ${OPTION_SETS[@]};
do
run_test_on_input_file_with_options "${TEST_SET_DIRECTORY}" "${TEST_DESCRIPTION}" "default" "${OPTION_SETS}" "${TEST_SCRIPT}" "${INPUT_FILE}";
RESULT=$?;
local TEST_DATA_OPTION_FILE=$(get_test_data_option_file "${TEST_SET_DIRECTORY}" "${INPUT_FILE}" "${OPTION_SET}");

if test ${RESULT} -ne ${EXIT_SUCCESS};
if test -f ${TEST_DATA_OPTION_FILE};
then
break;
TESTED_WITH_OPTIONS=1;

IFS=" " read -a OPTIONS <<< $(read_test_data_option_file "${TEST_SET_DIRECTORY}" "${INPUT_FILE}" "${OPTION_SET}");

run_test_on_input_file "${TEST_SET_DIRECTORY}" "${TEST_DESCRIPTION}" "default" "${OPTION_SET}" "${TEST_SCRIPT}" "${INPUT_FILE}" "${OPTIONS[@]}";
RESULT=$?;

if test ${RESULT} -ne ${EXIT_SUCCESS};
then
break;
fi
fi
done
else
for INPUT_FILE in `ls -1d ${TEST_SET_INPUT_DIRECTORY}/${INPUT_GLOB}`;
do
run_test_on_input_file_with_options "${TEST_SET_DIRECTORY}" "${TEST_DESCRIPTION}" "default" "${OPTION_SETS}" "${TEST_SCRIPT}" "${INPUT_FILE}";

if test ${TESTED_WITH_OPTIONS} -eq 0;
then
run_test_on_input_file "${TEST_SET_DIRECTORY}" "${TEST_DESCRIPTION}" "default" "" "${TEST_SCRIPT}" "${INPUT_FILE}";
RESULT=$?;
fi

if test ${RESULT} -ne ${EXIT_SUCCESS};
then
break;
fi
done
fi
IFS=${OLDIFS};
if test ${RESULT} -ne ${EXIT_SUCCESS};
then
break;
fi
done

if test ${RESULT} -ne ${EXIT_SUCCESS};
then
Expand Down
Loading

0 comments on commit 8c502af

Please sign in to comment.