Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions e2e/ci_bootstrap_suite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ test_section "basic bootstrap tests"
run_test "bootstrap"
run_test "bootstrap_extras"
run_test "bootstrap_build_tags"
run_test "bootstrap_iterative"

test_section "bootstrap constraint tests"
run_test "bootstrap_constraints"
Expand Down
76 changes: 76 additions & 0 deletions e2e/test_bootstrap_iterative.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
#!/bin/bash
# -*- indent-tabs-mode: nil; tab-width: 2; sh-indentation: 2; -*-

# Tests that the iterative bootstrap produces correct results for a
# package with transitive dependencies. Verifies that the LIFO-based
# iterative loop builds dependencies in the correct order (deps before
# their dependents) and that the build-order.json and graph.json are
# consistent.

SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$SCRIPTDIR/common.sh"

fromager \
--log-file="$OUTDIR/bootstrap.log" \
--error-log-file="$OUTDIR/fromager-errors.log" \
--sdists-repo="$OUTDIR/sdists-repo" \
--wheels-repo="$OUTDIR/wheels-repo" \
--work-dir="$OUTDIR/work-dir" \
bootstrap 'stevedore==5.2.0'

# Verify expected output files exist
EXPECTED_FILES="
$OUTDIR/wheels-repo/downloads/setuptools-*.whl
$OUTDIR/wheels-repo/downloads/pbr-*.whl
$OUTDIR/wheels-repo/downloads/stevedore-*.whl
$OUTDIR/work-dir/build-order.json
$OUTDIR/work-dir/graph.json
"

pass=true
for pattern in $EXPECTED_FILES; do
if [ ! -f "${pattern}" ]; then
echo "Did not find $pattern" 1>&2
pass=false
fi
done

# Verify build order: dependencies must appear before dependents
# pbr and setuptools must come before stevedore in build-order.json
BUILD_ORDER="$OUTDIR/work-dir/build-order.json"
pbr_idx=$(python3 -c "
import json, sys
data = json.load(open('$BUILD_ORDER'))
dists = [e['dist'] for e in data]
print(dists.index('pbr') if 'pbr' in dists else -1)
")
stevedore_idx=$(python3 -c "
import json, sys
data = json.load(open('$BUILD_ORDER'))
dists = [e['dist'] for e in data]
print(dists.index('stevedore') if 'stevedore' in dists else -1)
")

if [ "$pbr_idx" -ge "$stevedore_idx" ] || [ "$pbr_idx" -eq "-1" ]; then
echo "ERROR: pbr (idx=$pbr_idx) must appear before stevedore (idx=$stevedore_idx) in build order" 1>&2
pass=false
fi

# Verify graph.json has the expected dependency edges
python3 -c "
import json, sys
graph = json.load(open('$OUTDIR/work-dir/graph.json'))
# stevedore should exist as a node
stevedore_nodes = [k for k in graph if k.startswith('stevedore==')]
if not stevedore_nodes:
print('ERROR: stevedore not found in graph', file=sys.stderr)
sys.exit(1)
# pbr should exist as a node
pbr_nodes = [k for k in graph if k.startswith('pbr==')]
if not pbr_nodes:
print('ERROR: pbr not found in graph', file=sys.stderr)
sys.exit(1)
print('Graph structure verified')
" || pass=false

$pass
Loading
Loading