Skip to content

Commit 9531a20

Browse files
committed
Fix macOS QA test failures with rpath, bindings, and environment
17 tests failing + 10 skipping due to: - Broken rpath syntax (space vs comma in -Wl,-rpath) - Python/Perl bindings installing to wrong prefix - Missing TERM environment variable - Permission errors in PCP_RUN_DIR - Duplicated dependency installation logic Fixed by correcting Darwin linker flags in 12 makefiles, using --with-python-prefix for Homebrew Python, setting TERM in CI, fixing permissions, and creating shared dependency script.
1 parent f962189 commit 9531a20

17 files changed

Lines changed: 595 additions & 18 deletions

File tree

.cirrus.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,7 @@ task:
125125
brew --version
126126
brew list --versions | sort
127127
populate_script: |
128-
brew update --quiet || true
129-
brew install coreutils gnu-tar pkg-config python3 python-setuptools autoconf || true
128+
bash build/mac/scripts/install-deps.sh # Install all deps using shared script
130129
131130
enable_tcp_stats_script: |
132131
sudo sysctl -w net.inet.tcp.disable_access_to_stats=0
@@ -135,7 +134,10 @@ task:
135134
# Use realpath to resolve macOS symlinks (/etc -> /private/etc, /var -> /private/var)
136135
ETC=$(realpath /etc)
137136
VAR=$(realpath /var)
138-
./configure --sysconfdir=$ETC --localstatedir=$VAR --prefix=/usr/local --with-qt=no
137+
# Discover Homebrew Python prefix to install bindings to the right location
138+
PYTHON_PREFIX=$(python3 -c 'import sys; print(sys.prefix)')
139+
echo "Python prefix: $PYTHON_PREFIX"
140+
./configure --sysconfdir=$ETC --localstatedir=$VAR --prefix=/usr/local --with-python-prefix=$PYTHON_PREFIX --with-qt=no
139141
140142
build_script: |
141143
make -j$(sysctl -n hw.ncpu)
@@ -224,7 +226,14 @@ task:
224226
sudo -u pcpqa make clean
225227
sudo -u pcpqa make
226228
229+
fix_permissions_script: |
230+
# Fix PCP runtime directory permissions for pcpqa user
231+
. /etc/pcp.conf
232+
sudo chown -R pcpqa:staff $PCP_RUN_DIR
233+
sudo chmod -R 755 $PCP_RUN_DIR
234+
227235
run_qa_tests_script: |
228236
cd /var/lib/pcp/testsuite
237+
export TERM=xterm-256color # Fix terminal errors in test output
229238
sudo -u pcpqa ./check -g sanity -x not_in_ci
230239

.github/workflows/qa-macos.yml

Lines changed: 75 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
python-version: '3.13'
2424

2525
- name: Install macOS dependencies
26-
uses: ./.github/actions/install-macos-deps
26+
run: bash build/mac/scripts/install-deps.sh # Install all deps (no --minimal)
2727

2828
- name: Enable TCP stats
2929
run: |
@@ -38,7 +38,10 @@ jobs:
3838
# This matches the configuration used in Makepkgs for darwin
3939
ETC=$(realpath /etc)
4040
VAR=$(realpath /var)
41-
./configure --sysconfdir=$ETC --localstatedir=$VAR --prefix=/usr/local --with-qt=no
41+
# Discover Homebrew Python prefix to install bindings to the right location
42+
PYTHON_PREFIX=$(python3 -c 'import sys; print(sys.prefix)')
43+
echo "Python prefix: $PYTHON_PREFIX"
44+
./configure --sysconfdir=$ETC --localstatedir=$VAR --prefix=/usr/local --with-python-prefix=$PYTHON_PREFIX --with-qt=no
4245
4346
- name: Build PCP
4447
run: |
@@ -90,6 +93,35 @@ jobs:
9093
- name: Install PCP
9194
run: sudo make install
9295

96+
- name: Verify Python/Perl bindings installation
97+
run: |
98+
echo "=== Phase 2 Verification: Python/Perl Bindings ==="
99+
echo "Python search paths:"
100+
python3 -c "import sys; print('\n'.join(sys.path))"
101+
echo ""
102+
echo "Perl @INC paths:"
103+
perl -e 'print join("\n", @INC), "\n"'
104+
echo ""
105+
echo "Testing Python pcp.pmapi import..."
106+
python3 -c "from pcp import pmapi; print('✓ Python pcp.pmapi OK')" || {
107+
echo "✗ Python pcp.pmapi FAILED - checking installation location"
108+
find /usr/local/lib -name "pmapi.py" 2>/dev/null || echo "pmapi.py not found in /usr/local/lib"
109+
PYTHON_PREFIX=$(python3 -c 'import sys; print(sys.prefix)')
110+
find "$PYTHON_PREFIX/lib" -name "pmapi.py" 2>/dev/null || echo "pmapi.py not found in $PYTHON_PREFIX/lib either"
111+
# Set PYTHONPATH as fallback
112+
PY_VER=$(python3 -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")')
113+
export PYTHONPATH="/usr/local/lib/python${PY_VER}/site-packages:${PYTHONPATH:-}"
114+
echo "Setting PYTHONPATH=$PYTHONPATH as fallback"
115+
echo "PYTHONPATH=$PYTHONPATH" >> $GITHUB_ENV
116+
}
117+
echo ""
118+
echo "Testing Perl PCP::PMDA module..."
119+
perl -e "use PCP::PMDA; print '✓ Perl PCP::PMDA OK\n'" || {
120+
echo "✗ Perl PCP::PMDA FAILED - setting PERL5LIB"
121+
export PERL5LIB="/usr/local/lib/perl5/site_perl:/usr/local/lib/perl5/vendor_perl:${PERL5LIB:-}"
122+
echo "PERL5LIB=$PERL5LIB" >> $GITHUB_ENV
123+
}
124+
93125
- name: Rebuild PMNS
94126
run: |
95127
echo "Building PMNS root file from installed PMDA namespaces..."
@@ -347,6 +379,45 @@ jobs:
347379
./exercise -? 2>&1 | head -3 && echo "✓ Rebuilt binary works!"
348380
fi
349381
382+
- name: Verify rpath in test binaries
383+
run: |
384+
echo "=== Phase 1 Verification: Test Binary rpath ==="
385+
echo "Checking torture_cache binary..."
386+
otool -L /var/lib/pcp/testsuite/src/torture_cache | grep libpcp || echo "ERROR: No libpcp reference found"
387+
echo ""
388+
echo "Checking LC_RPATH load command..."
389+
otool -l /var/lib/pcp/testsuite/src/torture_cache | grep -A2 LC_RPATH || echo "ERROR: No LC_RPATH found"
390+
echo ""
391+
echo "Expected: Should show /usr/local/lib/libpcp.4.dylib and LC_RPATH with path /usr/local/lib"
392+
393+
- name: Fix PCP runtime directory permissions
394+
run: |
395+
echo "=== Fixing PCP runtime directory permissions for pcpqa ==="
396+
. /etc/pcp.conf
397+
sudo chown -R pcpqa:staff $PCP_RUN_DIR
398+
sudo chmod -R 755 $PCP_RUN_DIR
399+
echo "✓ Permissions fixed"
400+
ls -ld $PCP_RUN_DIR
401+
# Ensure user home directory exists for .pcp/run
402+
sudo mkdir -p /Users/runner/.pcp/run
403+
sudo chown -R runner:staff /Users/runner/.pcp
404+
echo "✓ User .pcp directory configured"
405+
406+
- name: Verify environment configuration
407+
run: |
408+
echo "=== Phase 3 Verification: Environment ==="
409+
echo "TERM=${TERM:-<not set>}"
410+
echo "PYTHONPATH=${PYTHONPATH:-<not set>}"
411+
echo "PERL5LIB=${PERL5LIB:-<not set>}"
412+
echo ""
413+
echo "PCP runtime directory permissions:"
414+
. /etc/pcp.conf
415+
ls -ld $PCP_RUN_DIR
416+
ls -l $PCP_RUN_DIR | head -10 || echo "Directory empty"
417+
echo ""
418+
echo "pcpqa user home directory:"
419+
ls -ld /Users/runner/.pcp 2>/dev/null || echo "/Users/runner/.pcp does not exist"
420+
350421
- name: Debug testsuite state before QA
351422
run: |
352423
echo "=========================================="
@@ -436,8 +507,10 @@ jobs:
436507
- name: Run QA sanity tests
437508
env:
438509
MAKEFLAGS: "" # Force serial make - no parallelism
510+
TERM: xterm-256color # Fix terminal errors in test output
439511
run: |
440512
cd /var/lib/pcp/testsuite
513+
export TERM=xterm-256color # Ensure TERM is set for subprocesses
441514
442515
# If localconfig doesn't exist, make setup will run
443516
# Capture its output explicitly

Makepkgs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,9 @@ then
303303
#
304304
etc=`realpath /etc`
305305
var=`realpath /var`
306-
configopts="--sysconfdir=$etc --localstatedir=$var --prefix=/usr/local --with-qt=no"
306+
# Discover Python prefix to install bindings to correct location (Homebrew vs system Python)
307+
python_prefix=`python3 -c 'import sys; print(sys.prefix)' 2>/dev/null || echo '/usr/local'`
308+
configopts="--sysconfdir=$etc --localstatedir=$var --prefix=/usr/local --with-python-prefix=$python_prefix --with-qt=no"
307309
PKGBUILD=`which pkgbuild`; export PKGBUILD
308310
elif [ $target = netbsd ]
309311
then

0 commit comments

Comments
 (0)