petsc: update to 3.23.3, test fixes (#24665)

This commit is contained in:
Oleg A. Khlybov 2025-06-29 15:24:22 +05:00 committed by GitHub
parent 79ead438e2
commit 4e1a8c068b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 74 additions and 58 deletions

View File

@ -28,11 +28,15 @@
# That is the ZMO suffix designates the optimized MPI parallel double precision complex library flavor.
# Consider the `pkg-config petsc-zmo --cflags` command to obtain the build-specific compilation flags.
# There is a Tcl integration test suite for both package maintainers and package end users
# to ensure the installed package is intact. The test suite performs a series of compile/run
# tests for multiple configurations from the build matrix.
# Basic usage: tclsh $MINGW_PREFIX/share/test/petsc/petsc.tcl
_realname=petsc
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}" "${MINGW_PACKAGE_PREFIX}-${_realname}-build")
pkgver=3.23.0
pkgver=3.23.3
pkgrel=1
pkgdesc='Sparse iterative (non)linear solver package (mingw-w64)'
arch=('any')
@ -56,7 +60,7 @@ makedepends=('python'
$([[ ${CARCH} == aarch64 ]] || echo "${MINGW_PACKAGE_PREFIX}-msmpi")
$([[ ${MINGW_PACKAGE_PREFIX} == *-clang-* ]] || echo "${MINGW_PACKAGE_PREFIX}-fc"))
optdepends=("${MINGW_PACKAGE_PREFIX}-tcl: build & run test suite")
source=("https://web.cels.anl.gov/projects/petsc/download/release-snapshots/${_realname}-lite-${pkgver}.tar.gz"
source=("https://web.cels.anl.gov/projects/petsc/download/release-snapshots/${_realname}-${pkgver}.tar.gz"
'petsc.tcl'
'testme-0.tm'
'buildme-0.tm'
@ -66,11 +70,11 @@ source=("https://web.cels.anl.gov/projects/petsc/download/release-snapshots/${_r
'0003-pid.patch'
'0004-set_output_format.patch'
'0005-with-pthread.patch')
noextract=("${_realname}-lite-${pkgver}.tar.gz")
sha256sums=('aeebd7094f4d583fd04700e73779caa7d9a3d54742e95eff2c3dd87768a79063'
noextract=("${_realname}-${pkgver}.tar.gz")
sha256sums=('bb51e8cbaa3782afce38c6f0bdd64d20ed090695992b7d49817518aa7e909139'
'5df892855b26560a2ccd1a258b70ac63a772dbde5ecc4a40a95e48c1f52b94ab'
'8d8f5670ffdf34a10b0d027bff976131824e2e6b053f8a13d207ecddd4663d6d'
'd0db2aa573c9aaf57b30cb3c2bd7c66e1677f3f468002f467da98b75943076b1'
'47aa9a8a03627ffeb299191ede391f5aa96071c1b09fb294ec6712e3beb0b799'
'e9585cccd9269c9ff3d68a6f9bb313d4cd64b86e5cc8d7b1f2db585e53c7a04d'
'285520fc2e38db814914e6a45a1417508cf9e819a27ac64185fe4bcc57c419ad'
'bef5353d6d10de492c9832f24b41993c38d1b36a78eb55e7d49089ba72acc05a'
'c954cc4240a6f3cebdc40cf4fca07561e58eb50717b9741c296b73657bac1c51'
@ -78,6 +82,7 @@ sha256sums=('aeebd7094f4d583fd04700e73779caa7d9a3d54742e95eff2c3dd87768a79063'
'254405c6c0eb5aa57b1cb74bbaf8876bcdb67d63136102e48a8036824bb9f129'
'bd7d1fa888d24f5183de992fb9377a4532cd9f38c5608018f5cd82f61e3096e9')
# Helper macros to help make tasks easier #
apply_patch_with_msg() {
for _fname in "$@"
@ -89,7 +94,7 @@ apply_patch_with_msg() {
prepare() {
mkdir -p "${srcdir}"/build-${MSYSTEM} && cd "${srcdir}"/build-${MSYSTEM}
tar xzf $srcdir/${_realname}-lite-${pkgver}.tar.gz
tar xzf $srcdir/${_realname}-${pkgver}.tar.gz
cd ${_realname}-${pkgver}
apply_patch_with_msg \
@ -111,9 +116,8 @@ fi
_petsc() {
desc=
opts="--with-single-library=1 --disable-shared --with-cxx=0 --with-windows-graphics=0 --with-x=0 --with-hwloc=1 --with-openblas=1 --with-openblas-dir=$MINGW_PREFIX"
opts="--with-single-library=1 --with-shared=0 --with-cxx=0 --with-windows-graphics=0 --with-x=0 --with-hwloc=1 --with-openblas=1 --with-openblas-dir=$MINGW_PREFIX"
pc="hwloc openblas"
iflags=
cflags="$CFLAGS"
cxxflags="$CXXFLAGS"
fflags="$CFLAGS -I$MINGW_PREFIX/include"
@ -121,9 +125,10 @@ _petsc() {
ldflags="$LDFLAGS"
pc_libs="$LIBS"
libs="$LIBS"
ld="$CXX"
ld="$CC"
if [[ ${MINGW_PACKAGE_PREFIX} != *-clang-* ]]; then
fflags+=" -fallow-invalid-boz -fallow-argument-mismatch"
opts+=" --with-fc=gfortran"
libs+=" -lgfortran -lquadmath"
pc_libs="$libs"
else
@ -142,13 +147,11 @@ _petsc() {
;;
?t?)
opts+=" --with-mpi=0 --with-pthread=0 --with-openmp=1"
iflags="$iflags -I\${includedir}/mpiuni"
ldflags+=" -fopenmp"
desc="OpenMP multithreaded"
;;
?s?)
opts+=" --with-mpi=0 --with-pthread=0 --with-openmp=0"
iflags+=" -I\${includedir}/mpiuni"
desc="Sequential"
;;
esac
@ -186,7 +189,7 @@ _petsc() {
}
build() {
cd "${srcdir}/build-${MSYSTEM}/${_realname}-${pkgver}"
cd "${srcdir}/build-${MSYSTEM}/${_realname}-${pkgver}"
if [[ ${MINGW_PACKAGE_PREFIX} != *-clang-* ]]; then
export FC=gfortran
# else
@ -211,44 +214,30 @@ eval "package_${MINGW_PACKAGE_PREFIX}-${_realname}() { _package; }"
eval "package_${MINGW_PACKAGE_PREFIX}-${_realname}-build() { _package_build; }"
_package() {
cd "${srcdir}"/build-${MSYSTEM}/${_realname}-${pkgver}
builddir="${srcdir}"/build-${MSYSTEM}/${_realname}-${pkgver}
cd "${builddir}"
mkdir -p "${pkgdir}"${MINGW_PREFIX}/{bin,lib/pkgconfig,lib/${_realname},include/${_realname},share/test/${_realname}/{ksp,mat}}
(
cd include
cp *.h "${pkgdir}"${MINGW_PREFIX}/include/${_realname}
cd ${_realname}
cp -R finclude mpiuni private "${pkgdir}"${MINGW_PREFIX}/include/${_realname}
cd "${pkgdir}"${MINGW_PREFIX}/include/${_realname}
find . \( ! -name '*.h' -a -type f \) -delete
)
(
cd "${srcdir}"
cp *.tcl *.tm "${pkgdir}"${MINGW_PREFIX}/share/test/${_realname}
)
(
cd src/ksp/ksp/tutorials
cp ex1.c ex2.c ex1f.F90 ex2f.F90 "${pkgdir}"${MINGW_PREFIX}/share/test/${_realname}/ksp
)
(
cd src/mat/tutorials
cp ex15.c ex15f.F90 "${pkgdir}"${MINGW_PREFIX}/share/test/${_realname}/mat
)
cd "${builddir}/include"
cp -R * "${pkgdir}"${MINGW_PREFIX}/include/${_realname}
for build in $builds; do
cd "${builddir}/${build}/include"
mkdir -p "${pkgdir}"${MINGW_PREFIX}/include/${_realname}/${build}
cp -R * "${pkgdir}"${MINGW_PREFIX}/include/${_realname}/${build}
done
cd "${pkgdir}"${MINGW_PREFIX}/include/${_realname}
find . \( ! \( -name '*.h' -o -name '*.hpp' -o -name '*.mod' \) -a -type f \) -delete
cd "${srcdir}"
cp petsc.tcl {testme-0,buildme-0,xyz-0}.tm "${pkgdir}"${MINGW_PREFIX}/share/test/${_realname}
cd "${builddir}/src/ksp/ksp/tutorials"
cp ex1.c ex2.c ex1f.F90 ex2f.F90 "${pkgdir}"${MINGW_PREFIX}/share/test/${_realname}/ksp
cd "${builddir}/src/mat/tutorials"
cp ex15.c ex15f.F90 "${pkgdir}"${MINGW_PREFIX}/share/test/${_realname}/mat
for build in ${builds}; do
_petsc ${build}
(
cd ${build}/lib
mkdir -p "${pkgdir}"${MINGW_PREFIX}/lib/${_realname}/${build}
cp *.a "${pkgdir}"${MINGW_PREFIX}/lib/${_realname}/${build}
cp *.dll "${pkgdir}"${MINGW_PREFIX}/bin
)
(
cd ${build}/include
mkdir -p "${pkgdir}"${MINGW_PREFIX}/include/${_realname}/${build}
cp *.h "${pkgdir}"${MINGW_PREFIX}/include/${_realname}/${build}
if [[ ${MINGW_PACKAGE_PREFIX} != *-clang-* ]]; then
cp *.mod "${pkgdir}"${MINGW_PREFIX}/include/${_realname}/${build}
fi
)
cd "${builddir}/${build}/lib"
mkdir -p "${pkgdir}"${MINGW_PREFIX}/lib/${_realname}/${build}
cp *.a "${pkgdir}"${MINGW_PREFIX}/lib/${_realname}/${build}
cp *.dll "${pkgdir}"${MINGW_PREFIX}/bin
echo "
prefix=${MINGW_PREFIX}
libdir=\${prefix}/lib/${_realname}
@ -258,7 +247,7 @@ _package() {
Version: ${pkgver}
Description: ${desc} PETSc build
Requires.private: ${pc}
Cflags: -I\${includedir}/${build} -I\${includedir} ${iflags}
Cflags: -I\${includedir}/${build} -I\${includedir}
Libs.private: -L\${libdir}/${build} -l${_realname} ${ldflags} ${pc_libs}
Libs: -L\${libdir}/${build} -l${_realname}
" | sed '/^\s*$/d;s/^\s*//' > "${pkgdir}"${MINGW_PREFIX}/lib/pkgconfig/${_realname}-${build}.pc

View File

@ -1,3 +1,4 @@
# Testme - a testing pico framework for Tcl
# https://github.com/okhlybov/testme

View File

@ -1,3 +1,4 @@
# Testme - a testing pico framework for Tcl
# https://github.com/okhlybov/testme
@ -280,6 +281,9 @@ namespace eval ::testme {
variable verbose false
variable full false
variable quiet false
@ -298,6 +302,7 @@ namespace eval ::testme {
set opts {
{{--jobs= -j=} -info "set maximum number of allowed threads" -default 0 -slot jobs}
{{-v --verbose} -info "dump unit output to standard error channel" -default true -slot verbose}
{{-F --full-dump} -info "dump unit output for succeeded tests as well" -default true -slot full}
{{-T --staging} -info "manage staging directory in \$TMPDIR" -default true -slot staging}
{{-K --keep} -info "keep temporary directories & files" -default false -slot cleanup}
{{-e --bailout} -info "bail out on first failure" -default true -slot premature}
@ -405,7 +410,7 @@ namespace eval ::testme {
proc skip {{reason {}}} {return -code 1073741823 -level 0 $reason}
proc process-unit {unit} {
proc process {unit} {
variable stdout [list]
variable stderr [list]
interp create unit
@ -482,7 +487,7 @@ namespace eval ::testme {
set unit [dict create {*}$opts -stage [pwd] -name $name -tags $tags -code $code -id $id -source $::argv0 -cleanup $cleanup]
dict set units $id $unit
if {([llength ${+tags}] == 0 || [llength [intersection ${+tags} $tags]] > 0) && [llength [intersection ${-tags} $tags]] == 0} {
lappend pending [tpool::post $executor "process-unit {$unit}"]
lappend pending [tpool::post $executor "process {$unit}"]
} else {
lappend skipped $id
}
@ -544,11 +549,16 @@ namespace eval ::testme {
set u [dict get $units [dict get $return -id]]
set name [dict get $u -name]
set id [dict get $u -id]
switch [dict get $return -code] {
0 {set outcome succeeded}
1073741823 {set outcome skipped}
default {set outcome failed}
}
if {!$quiet} {
switch [dict get $return -code] {
0 {puts "ok $id - $name"}
1073741823 {puts "ok $id - $name # SKIP [dict get $return -return]"}
default {
switch $outcome {
succeeded {puts "ok $id - $name"}
skipped {puts "ok $id - $name # SKIP [dict get $return -return]"}
failed {
puts "not ok $id - $name"
puts " ---"
set lines [split [dict get $return -return] "\n"]
@ -561,7 +571,7 @@ namespace eval ::testme {
}
}
}
if {$verbose} {
if {$verbose && ($full || $outcome eq {failed})} {
set stdout [dict get $return -stdout]
set stderr [dict get $return -stderr]
if {[llength $stdout] + [llength $stderr] > 0} {
@ -579,7 +589,23 @@ namespace eval ::testme {
}
flush stdout
flush stderr
if {$premature && [dict get $return -code] != 0} {error "bailing out on failure"}
if {!$cleanup} {
# Writing channels contents to log files makes no sense unless staging directory is preserved for inspection
foreach x {stdout stderr} {
set s [dict get $return -$x]
if {[llength $s] > 0} {
try {
set f [open $x.out w]
try {
foreach t $s {puts $f $t}
} finally {
close $f
}
}
}
}
}
if {$premature && $outcome eq {failed}} {error "bailing out on failure"}
}
}
@ -587,7 +613,7 @@ namespace eval ::testme {
} finally {
if {$cleanup && $staging != {false}} {
if {$cleanup && $staging ne {false}} {
if {[catch {file delete -force -- $staging}]} {
if {$verbose} {puts stderr "failed to remove temporary directory $staging"}
} else {