CI updates
This commit is contained in:
@@ -204,10 +204,10 @@ jobs:
|
|||||||
# only run "brew update" if needed
|
# only run "brew update" if needed
|
||||||
if ! brew install coreutils; then brew update && brew install coreutils; fi
|
if ! brew install coreutils; then brew update && brew install coreutils; fi
|
||||||
fi
|
fi
|
||||||
|
echo "UPX_DEBUG_FORCE_PACK_MACOS=1" >> $GITHUB_ENV
|
||||||
case "${{ matrix.os }}" in
|
case "${{ matrix.os }}" in
|
||||||
macos-11 | macos-12) echo "UPX_DEBUG_FORCE_PACK_MACOS=1" >> $GITHUB_ENV ;;
|
# FIXME: UPX on macos-13+ is broken => disable run-packed for now
|
||||||
# FIXME: UPX on macos-13+ is broken => disable self-test for now
|
macos-13 | macos-14) echo "UPX_CONFIG_DISABLE_RUN_PACKED_TEST=ON" >> $GITHUB_ENV ;;
|
||||||
macos-13 | macos-14) echo "UPX_CONFIG_DISABLE_SELF_PACK_TEST=ON" >> $GITHUB_ENV ;;
|
|
||||||
esac
|
esac
|
||||||
- name: 'Check out code'
|
- name: 'Check out code'
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -265,6 +265,7 @@ jobs:
|
|||||||
if: ${{ matrix.testsuite }} # for coreutils readlink
|
if: ${{ matrix.testsuite }} # for coreutils readlink
|
||||||
run: |
|
run: |
|
||||||
export PATH="$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$PATH"
|
export PATH="$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$PATH"
|
||||||
|
export upx_test_file="$PWD"/build/extra/clang/release/upx
|
||||||
env -C build/extra/clang/release bash "$PWD"/misc/testsuite/test_symlinks.sh
|
env -C build/extra/clang/release bash "$PWD"/misc/testsuite/test_symlinks.sh
|
||||||
- name: 'Run test suite build/extra/clang/release'
|
- name: 'Run test suite build/extra/clang/release'
|
||||||
if: ${{ matrix.testsuite }}
|
if: ${{ matrix.testsuite }}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ upx_add_test(upx-unpack-nrv2d upx -d upx-packed-nrv2d${exe} ${fo} -o upx-u
|
|||||||
upx_add_test(upx-unpack-nrv2e upx -d upx-packed-nrv2e${exe} ${fo} -o upx-unpacked-nrv2e${exe})
|
upx_add_test(upx-unpack-nrv2e upx -d upx-packed-nrv2e${exe} ${fo} -o upx-unpacked-nrv2e${exe})
|
||||||
upx_add_test(upx-unpack-lzma upx -d upx-packed-lzma${exe} ${fo} -o upx-unpacked-lzma${exe})
|
upx_add_test(upx-unpack-lzma upx -d upx-packed-lzma${exe} ${fo} -o upx-unpacked-lzma${exe})
|
||||||
|
|
||||||
# all unpacked files must be identical!
|
# all unpacked files must be identical
|
||||||
upx_add_test(upx-compare-fa "${CMAKE_COMMAND}" -E compare_files upx-unpacked${exe} upx-unpacked-fa${exe})
|
upx_add_test(upx-compare-fa "${CMAKE_COMMAND}" -E compare_files upx-unpacked${exe} upx-unpacked-fa${exe})
|
||||||
upx_add_test(upx-compare-fn "${CMAKE_COMMAND}" -E compare_files upx-unpacked${exe} upx-unpacked-fn${exe})
|
upx_add_test(upx-compare-fn "${CMAKE_COMMAND}" -E compare_files upx-unpacked${exe} upx-unpacked-fn${exe})
|
||||||
upx_add_test(upx-compare-fr "${CMAKE_COMMAND}" -E compare_files upx-unpacked${exe} upx-unpacked-fr${exe})
|
upx_add_test(upx-compare-fr "${CMAKE_COMMAND}" -E compare_files upx-unpacked${exe} upx-unpacked-fr${exe})
|
||||||
|
|||||||
Executable
+17
@@ -0,0 +1,17 @@
|
|||||||
|
#! /usr/bin/env python3
|
||||||
|
## vim:set ts=4 sw=4 et: -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# simulate "readlink -en FILE"
|
||||||
|
# - result may differ from actual readlink(1) for edge cases
|
||||||
|
# - works with Python2 and Python3
|
||||||
|
#
|
||||||
|
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
|
||||||
|
|
||||||
|
import os, sys
|
||||||
|
if len(sys.argv) != 2:
|
||||||
|
sys.exit(1)
|
||||||
|
real_path = os.path.realpath(sys.argv[1])
|
||||||
|
if not os.path.exists(real_path):
|
||||||
|
sys.exit(1)
|
||||||
|
sys.stdout.write(real_path)
|
||||||
|
sys.stdout.flush()
|
||||||
@@ -10,5 +10,6 @@
|
|||||||
import os, sys
|
import os, sys
|
||||||
if len(sys.argv) != 2:
|
if len(sys.argv) != 2:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
sys.stdout.write(os.path.realpath(sys.argv[1]))
|
real_path = os.path.realpath(sys.argv[1])
|
||||||
|
sys.stdout.write(real_path)
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
|
|||||||
@@ -10,10 +10,11 @@ argv0=$0; argv0abs=$(readlink -fn "$argv0"); argv0dir=$(dirname "$argv0abs")
|
|||||||
# $upx_exe (required, but with convenience fallback "./upx")
|
# $upx_exe (required, but with convenience fallback "./upx")
|
||||||
# optional settings:
|
# optional settings:
|
||||||
# $upx_exe_runner (e.g. "qemu-x86_64 -cpu Nehalem" or "valgrind")
|
# $upx_exe_runner (e.g. "qemu-x86_64 -cpu Nehalem" or "valgrind")
|
||||||
|
# $upx_test_file
|
||||||
#
|
#
|
||||||
|
|
||||||
# IMPORTANT NOTE: do NOT run as user root!!
|
# IMPORTANT NOTE: this script only works on Unix
|
||||||
# IMPORTANT NOTE: this script only works on Unix!!
|
# IMPORTANT NOTE: do NOT run as user root!
|
||||||
umask 0022
|
umask 0022
|
||||||
|
|
||||||
# disable on macOS for now, see https://github.com/upx/upx/issues/612
|
# disable on macOS for now, see https://github.com/upx/upx/issues/612
|
||||||
@@ -61,7 +62,7 @@ if ! "${run_upx[@]}" -L >/dev/null 2>&1; then echo "UPX-ERROR: FATAL: upx -L FAI
|
|||||||
if ! "${run_upx[@]}" --help >/dev/null; then echo "UPX-ERROR: FATAL: upx --help FAILED"; exit 1; fi
|
if ! "${run_upx[@]}" --help >/dev/null; then echo "UPX-ERROR: FATAL: upx --help FAILED"; exit 1; fi
|
||||||
|
|
||||||
#***********************************************************************
|
#***********************************************************************
|
||||||
# util
|
# util functions
|
||||||
#***********************************************************************
|
#***********************************************************************
|
||||||
|
|
||||||
exit_code=0
|
exit_code=0
|
||||||
@@ -162,17 +163,7 @@ create_files() {
|
|||||||
chmod -R a-w z_dir_4
|
chmod -R a-w z_dir_4
|
||||||
}
|
}
|
||||||
|
|
||||||
#***********************************************************************
|
print_header() {
|
||||||
#
|
|
||||||
#***********************************************************************
|
|
||||||
|
|
||||||
#set -x # debug
|
|
||||||
|
|
||||||
export UPX="--prefer-ucl --no-color --no-progress"
|
|
||||||
export UPX_DEBUG_DISABLE_GITREV_WARNING=1
|
|
||||||
export UPX_DEBUG_DOCTEST_DISABLE=1 # already checked above
|
|
||||||
|
|
||||||
testsuite_header() {
|
|
||||||
local x='==========='; x="$x$x$x$x$x$x$x"
|
local x='==========='; x="$x$x$x$x$x$x$x"
|
||||||
echo -e "\n${x}\n${1}\n${x}\n"
|
echo -e "\n${x}\n${1}\n${x}\n"
|
||||||
}
|
}
|
||||||
@@ -187,19 +178,40 @@ leave_dir() {
|
|||||||
cd ..
|
cd ..
|
||||||
}
|
}
|
||||||
|
|
||||||
# create a tmpdir in current directory
|
#***********************************************************************
|
||||||
tmpdir="$(mktemp -d tmp-upx-test-XXXXXX)"
|
# setup
|
||||||
cd "./$tmpdir" || exit 1
|
#***********************************************************************
|
||||||
|
|
||||||
for test_file in /usr/bin/make /usr/bin/gmake /usr/bin/env /bin/ls; do
|
#set -x # debug
|
||||||
|
|
||||||
|
export UPX="--prefer-ucl --no-color --no-progress"
|
||||||
|
export UPX_DEBUG_DISABLE_GITREV_WARNING=1
|
||||||
|
export UPX_DEBUG_DOCTEST_DISABLE=1 # already checked above
|
||||||
|
|
||||||
|
# get $test_file
|
||||||
|
if [[ -f $upx_test_file ]]; then
|
||||||
|
test_file="$(readlink -fn "$upx_test_file")"
|
||||||
|
else
|
||||||
|
for test_file in /usr/bin/gmake /usr/bin/make /usr/bin/env /bin/ls; do
|
||||||
if [[ -f $test_file ]]; then
|
if [[ -f $test_file ]]; then
|
||||||
test_file="$(readlink -fn "$test_file")"
|
test_file="$(readlink -fn "$test_file")"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
fi
|
||||||
|
ls -l "$test_file"
|
||||||
|
file "$test_file" || true
|
||||||
|
|
||||||
testsuite_header "default"
|
# create and enter a tmpdir in the current directory
|
||||||
flags="-qq -1 --no-filter"
|
tmpdir="$(mktemp -d tmp-upx-test-XXXXXX)"
|
||||||
|
cd "./$tmpdir" || exit 1
|
||||||
|
|
||||||
|
#***********************************************************************
|
||||||
|
# default
|
||||||
|
#***********************************************************************
|
||||||
|
|
||||||
|
print_header "default"
|
||||||
|
flags="-qq -2 --no-filter"
|
||||||
mkdir default
|
mkdir default
|
||||||
cd default
|
cd default
|
||||||
create_files
|
create_files
|
||||||
@@ -261,8 +273,12 @@ assert_symlink_dangling z_symlink_dangling
|
|||||||
leave_dir
|
leave_dir
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
testsuite_header "force-overwrite"
|
#***********************************************************************
|
||||||
flags="-qq -1 --no-filter --force-overwrite"
|
# force-overwrite
|
||||||
|
#***********************************************************************
|
||||||
|
|
||||||
|
print_header "force-overwrite"
|
||||||
|
flags="-qq -2 --no-filter --force-overwrite"
|
||||||
mkdir force-overwrite
|
mkdir force-overwrite
|
||||||
cd force-overwrite
|
cd force-overwrite
|
||||||
create_files
|
create_files
|
||||||
@@ -324,9 +340,12 @@ assert_symlink_dangling z_symlink_dangling
|
|||||||
leave_dir
|
leave_dir
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
if [[ 1 == 1 ]]; then
|
#***********************************************************************
|
||||||
testsuite_header "link"
|
# link
|
||||||
flags="-qq -1 --no-filter --link"
|
#***********************************************************************
|
||||||
|
|
||||||
|
print_header "link"
|
||||||
|
flags="-qq -2 --no-filter --link"
|
||||||
mkdir link
|
mkdir link
|
||||||
cd link
|
cd link
|
||||||
create_files
|
create_files
|
||||||
@@ -387,7 +406,10 @@ assert_symlink_to_dir z_symlink_dir
|
|||||||
assert_symlink_dangling z_symlink_dangling
|
assert_symlink_dangling z_symlink_dangling
|
||||||
leave_dir
|
leave_dir
|
||||||
cd ..
|
cd ..
|
||||||
fi
|
|
||||||
|
#***********************************************************************
|
||||||
|
# done
|
||||||
|
#***********************************************************************
|
||||||
|
|
||||||
# clean up
|
# clean up
|
||||||
cd ..
|
cd ..
|
||||||
|
|||||||
+8
-4
@@ -69,6 +69,8 @@ struct LE16;
|
|||||||
struct LE32;
|
struct LE32;
|
||||||
struct LE64;
|
struct LE64;
|
||||||
|
|
||||||
|
namespace bele_detail {
|
||||||
|
|
||||||
// Note:
|
// Note:
|
||||||
// void is explicitly allowed (but there is no automatic pointer conversion because of template!)
|
// void is explicitly allowed (but there is no automatic pointer conversion because of template!)
|
||||||
// char is explicitly allowed
|
// char is explicitly allowed
|
||||||
@@ -94,10 +96,12 @@ using enable_if_xe32 = std::enable_if_t<is_xe32_type<T>, T>;
|
|||||||
template <class T>
|
template <class T>
|
||||||
using enable_if_xe64 = std::enable_if_t<is_xe64_type<T>, T>;
|
using enable_if_xe64 = std::enable_if_t<is_xe64_type<T>, T>;
|
||||||
|
|
||||||
#define REQUIRE_XE16 template <class XE16, class = enable_if_xe16<XE16> >
|
} // namespace bele_detail
|
||||||
#define REQUIRE_XE24 template <class XE24, class = enable_if_xe24<XE24> >
|
|
||||||
#define REQUIRE_XE32 template <class XE32, class = enable_if_xe32<XE32> >
|
#define REQUIRE_XE16 template <class XE16, class = bele_detail::enable_if_xe16<XE16> >
|
||||||
#define REQUIRE_XE64 template <class XE64, class = enable_if_xe64<XE64> >
|
#define REQUIRE_XE24 template <class XE24, class = bele_detail::enable_if_xe24<XE24> >
|
||||||
|
#define REQUIRE_XE32 template <class XE32, class = bele_detail::enable_if_xe32<XE32> >
|
||||||
|
#define REQUIRE_XE64 template <class XE64, class = bele_detail::enable_if_xe64<XE64> >
|
||||||
|
|
||||||
#endif // permissive version
|
#endif // permissive version
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -161,7 +161,7 @@ inline R *xspan_make_helper__(MemBuffer &mb) noexcept {
|
|||||||
// cast to a different type (creates a new value)
|
// cast to a different type (creates a new value)
|
||||||
#define XSPAN_TYPE_CAST(type, x) (upx::ptr_static_cast<type *>(x))
|
#define XSPAN_TYPE_CAST(type, x) (upx::ptr_static_cast<type *>(x))
|
||||||
// poison a pointer: point to a non-null invalid address
|
// poison a pointer: point to a non-null invalid address
|
||||||
#define XSPAN_INVALIDATE(x) ptr_invalidate_and_poison(x)
|
#define XSPAN_INVALIDATE(x) (ptr_invalidate_and_poison(x))
|
||||||
|
|
||||||
#endif // WITH_XSPAN
|
#endif // WITH_XSPAN
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user