OILS / regtest / aports-run.sh View on Github | oils.pub

772 lines, 360 significant
1#!/usr/bin/env bash
2#
3# Build Alpine Linux packages: baseline, OSH as /bin/sh, OSH as /bin/bash
4# See regtest/aports.md
5#
6# Usage:
7# regtest/aports-run.sh <function name>
8#
9# Common usage:
10#
11# export APORTS_EPOCH=2025-08-04-foo # optional override
12# $0 build-many-shards-overlayfs shard{0..16} # build all 17 shards in 2 configs
13#
14# Also useful:
15#
16# $0 fetch-packages fetch $pkg_filter $a_repo # alpine repo is 'main' or 'community'
17#
18# $0 fetch-packages fetch 100,300p # packages 100-300
19# $0 fetch-packages fetch '.*' # all packages
20#
21# Look for results in _tmp/aports-build/
22#
23# Build many packages:
24#
25# $0 build-packages-overlayfs osh-as-sh shard9 community
26# $0 build-packages-overlayfs osh-as-sh shardA # main is default $a_repo
27#
28# Build a single package:
29#
30# $0 build-package-overlayfs osh-as-sh userspace-rcu
31# $0 build-package-overlayfs osh-as-sh xterm community # community repo
32#
33# Drop into a shell:
34# INTERACTIVE=1 $0 build-package-overlayfs osh-as-sh userspace-rcu
35#
36# PKG_FILTER
37# shard[0-9]+ - shard3 is packages 301 to 400
38# [0-9]+ - 42 means build the first 42 packages
39# [0-9]+,[0-9]+p - 100,300p packages 100 to 300 (sed syntax)
40# ALL - all packages
41# .* - egrep pattern matching all packages
42# curl - egrep pattern matching 'curl'
43#
44# Preview packages:
45#
46# $0 package-dirs shard9 community
47
48: ${LIB_OSH=stdlib/osh}
49source $LIB_OSH/bash-strict.sh
50source $LIB_OSH/task-five.sh
51
52source regtest/aports-common.sh
53
54#
55# Config
56#
57
58show-config() {
59 enter-rootfs sh -c '
60 ls -l /bin/sh /bin/ash /bin/bash
61 '
62}
63
64set-baseline() {
65 # ensure we have the default config
66 enter-rootfs sh -c '
67 set -x
68 ln -s -f /bin/busybox /bin/sh
69 ln -s -f /bin/busybox /bin/ash
70 cp /bin/bash.ORIG /bin/bash
71 '
72 show-config
73}
74
75set-osh-as-X() {
76 local x=$1
77
78 enter-rootfs sh -c '
79 x=$1
80 set -x
81 if ! test -f /usr/local/bin/oils-for-unix; then
82 echo "Build Oils first"
83 exit
84 fi
85 ln -s -f /usr/local/bin/oils-for-unix /bin/$x
86 ' dummy0 "$x"
87 show-config
88}
89
90set-osh-as-sh() {
91 set-osh-as-X sh
92}
93
94set-osh-as-ash() {
95 set-osh-as-X ash
96}
97
98set-osh-as-bash() {
99 set-osh-as-X bash
100}
101
102#
103# Run
104#
105
106package-dirs() {
107 # lz gives 5 packages: some fail at baseline
108 # lzip: a single fast package
109 # mpfr4: OSH bug, and big log
110 # yash: make sure it doesn't hang
111 local package_filter=${1:-'lz|mpfr|yash'}
112 local a_repo=${2:-main} # or 'community'
113
114 local -a prefix
115
116 if [[ $package_filter = 'ALL' ]]; then
117 prefix=( cat )
118
119 # 100 means 0 to 100
120 elif [[ $package_filter =~ ^[0-9]+$ ]]; then
121 prefix=( head -n $package_filter )
122
123 # 100,300p means lines 100 to 300
124 elif [[ $package_filter =~ ^[0-9]+,[0-9]+p$ ]]; then
125 prefix=( sed -n $package_filter )
126
127 elif [[ $package_filter =~ ^shard([0-9]+)$ ]]; then
128 # shards of 100 packages
129
130 local shard_num=${BASH_REMATCH[1]}
131 #echo shard=$shard_num
132
133 local range
134 # shard 0 is 0-99
135 # shard 9 is 900 to 999
136 # shard 10 is 1000 to 1099
137 case $shard_num in
138 # sed doesn't like 000,099
139 0) range='1,100p' ;;
140 *) range="${shard_num}01,$(( shard_num + 1))00p" ;;
141 esac
142
143 prefix=( sed -n "$range" )
144
145 # shardA, shardB For testing the combined report
146 elif [[ $package_filter =~ ^shard([A-Z]+)$ ]]; then
147 local shard_name=${BASH_REMATCH[1]}
148 case $a_repo in
149 main)
150 case $shard_name in
151 A) package_filter='^gzip' ;; # failure
152 B) package_filter='^xz' ;; # failure
153 C) package_filter='^lz' ;; # 3 packages
154 D) package_filter='^jq$' ;; # produces autotools test-suite.log
155 E) package_filter='^py3-p' ;; # many packages in parallel
156 F) package_filter='^py3-pathspec' ;; # very fast package
157 P) package_filter='^xz$|^shorewall' ;; # patches
158 *) package_filter='^perl-http-daemon' ;; # test out perl
159 esac
160 ;;
161 community)
162 case $shard_name in
163 A) package_filter='^py3-zulip' ;; # one Python package
164 B) package_filter='^xterm' ;; # one C package
165 C) package_filter='^shfmt' ;; # one Go package
166 D) package_filter='^shellspec' ;; # OSH disagreement because of 'var'
167 *) package_filter='^shell' ;; # a bunch of packages
168 esac
169 ;;
170 *)
171 die "Invalid a_repo $a_repo"
172 ;;
173 esac
174
175 prefix=( egrep "$package_filter" )
176
177 elif [[ $package_filter =~ ^disagree-(.*)+$ ]]; then
178 local filename=${BASH_REMATCH[1]}
179 # A file of EXACT package names, not patterns
180 # See copy-disagree
181 local package_file="_tmp/$package_filter.txt"
182 comm -1 -2 <(sort $package_file) <(sort _tmp/apk-${a_repo}-manifest.txt)
183 return
184
185 else
186 prefix=( egrep "$package_filter" )
187
188 fi
189
190 "${prefix[@]}" _tmp/apk-${a_repo}-manifest.txt
191}
192
193copy-disagree() {
194 ### Determine what to run
195
196 local epoch=${1:-2025-09-18-bash}
197 cp -v \
198 _tmp/aports-report/$epoch/disagree-packages.txt \
199 _tmp/disagree-$epoch.txt
200}
201
202do-packages() {
203 ### Download sources - abuild puts it in /var/cahe/distfiles
204 local action=${1:-fetch}
205 local package_filter=${2:-}
206 local a_repo=${3:-main}
207 # flags to pass to the inner shell
208 local sh_flags=${4:-'-e -u'} # -u to disable -e
209
210 # 6 seconds for 10 packages
211 # There are ~1600 packages
212 # So if there are 20 shards, each shard could have 10?
213
214 local -a package_dirs
215 package_dirs=( $(package-dirs "$package_filter" "$a_repo") )
216
217 echo "${dirs[@]}"
218 #return
219
220 time enter-rootfs-user sh $sh_flags -c '
221
222 action=$1
223 a_repo=$2
224 shift 2
225 for dir in "$@"; do
226 time abuild -r -C aports/$a_repo/$dir "$action"
227 done
228 ' dummy0 "$action" "$a_repo" "${package_dirs[@]}"
229}
230
231fetch-packages() {
232 local package_filter=${1:-}
233 local a_repo=${2:-main}
234
235 # -u means we don't pass -e (and it's non-empty)
236 do-packages fetch "$package_filter" "$a_repo" '-u'
237}
238
239banner() {
240 echo
241 echo "=== $@"
242 echo
243}
244
245build-package-overlayfs() {
246 local config=${1:-baseline}
247 local pkg=${2:-lua5.4}
248 local a_repo=${3:-main}
249
250 # baseline stack:
251 # _chroot/aports-build
252 # _chroot/package-upper/baseline/gzip # upper dir / layer dir
253 #
254 # osh-as-sh stack:
255 # _chroot/aports-build
256 # _chroot/osh-as-sh.overlay/layer # this has the symlink
257 # _chroot/package-upper/osh-as-sh/gzip # upper dir / layer dir
258
259 # allow concurrency
260 local xargs_slot="${XARGS_SLOT:-99}"
261 local ov_base_dir=_chroot/package-slot${xargs_slot}.overlay
262
263 local merged=$ov_base_dir/merged
264 local work=$ov_base_dir/work
265
266 local layer_dir=_chroot/package-layers/$config/$pkg
267 mkdir -p $merged $work $layer_dir
268
269 local overlay_opts
270 case $config in
271 baseline)
272 overlay_opts="lowerdir=$CHROOT_DIR,upperdir=$layer_dir,workdir=$work"
273 ;;
274 osh-as-sh)
275 local osh_as_sh=_chroot/osh-as-sh.overlay/layer
276 overlay_opts="lowerdir=$osh_as_sh:$CHROOT_DIR,upperdir=$layer_dir,workdir=$work"
277 ;;
278 *)
279 die "Invalid config $config"
280 ;;
281 esac
282
283 # -o index=off fixes this error: fsconfig() failed: Stale file handle
284 # See also https://oilshell.zulipchat.com/#narrow/channel/522730-distros/topic/setting.20up.20regtest.2Faports-setup.2Esh/with/544318771
285 sudo mount \
286 -t overlay \
287 aports-package \
288 -o "$overlay_opts" \
289 -o index=off \
290 $merged
291
292 # mount over the overlay, onto the merged
293 # https://man7.org/linux/man-pages/man5/procfs.5.html
294 sudo mount \
295 -t proc \
296 "_chroot_proc_${xargs_slot}" $merged/proc
297
298 # https://man7.org/linux/man-pages/man5/sysfs.5.html
299 sudo mount \
300 -t sysfs \
301 "_chroot_sysfs_${xargs_slot}" $merged/sys
302
303 # https://lwn.net/Articles/330985/
304 sudo mount \
305 -t devtmpfs \
306 "_chroot_devtmpfs_${xargs_slot}" $merged/dev
307
308 local -a prefix
309 if test -n "${XARGS_SLOT:-}"; then
310 local x=$XARGS_SLOT
311
312 # run slot 0 on cores 0 and 1
313 # run slot 9 on cores 18 and 19
314 local cores="$(( x*2 )),$(( x*2 + 1 ))"
315
316 # oversubscribe
317 # run slot 0 on cores 0 and 1
318 # run slot 19 on cores 19 and 0
319 #local cores="$(( x )),$(( (x + 1) % NUM_CORES ))"
320 prefix=( taskset -c "$cores" )
321 fi
322
323 "${prefix[@]}" $merged/enter-chroot -u udu sh -c '
324 cd oils
325
326 # show the effect of the overlay
327 #ls -l /bin/sh
328
329 regtest/aports-guest.sh build-one-package "$@"
330 ' dummy0 "$pkg" "$a_repo" "$xargs_slot"
331
332 if test -n "$INTERACTIVE"; then
333 echo "Starting interactive shell in overlayfs environment for package $a_repo/$pkg"
334 echo "Rebuild: abuild -f -r -C ~/aports/$a_repo/$pkg -k -K"
335 echo " Help: abuild -h"
336 # If the last command in the child shell exited non-zero then ctrl-d/exit
337 # will report that error code to the parent. If we don't ignore that error
338 # we will exit early and leave the package overlay mounted.
339 set +o errexit
340 $merged/enter-chroot -u udu
341 set -o errexit
342 fi
343
344 unmount-loop $merged/proc
345 unmount-loop $merged/sys
346 unmount-loop $merged/dev
347 unmount-loop $merged
348}
349
350build-pkg() {
351 ### trivial wrapper around build-package-overlayfs - change arg order for xargs
352 local config=${1:-baseline}
353 local a_repo=${2:-main}
354 local pkg=${3:-lua5.4}
355
356 build-package-overlayfs "$config" "$pkg" "$a_repo"
357
358 # TODO:
359 # - we should only do this after we've done BOTH configs, so it appears
360 # atomically
361 save-package-files $config $a_repo $pkg
362
363 # TODO: blow away the layer dir, since we saved the "tombstone".
364 # We're not doing this now because we're still reporting off DEPRECATED shard
365 # files.
366}
367
368LOG_SIZE_THRESHOLD=$(( 500 * 1000 )) # 500 KB
369#LOG_SIZE_THRESHOLD=$(( 1 * 1000 ))
370
371abridge-one-log() {
372 local src=$1
373 local dest=$2
374
375 local size
376 size=$(stat --format '%s' $src)
377 if test $size -lt $LOG_SIZE_THRESHOLD; then
378 #cp --verbose $src $dest
379 cp $src $dest
380 else
381 # Bug fix: abridging to 1000 lines isn't sufficient. We got some logs
382 # that were hundreds of MB, with less than 1000 lines!
383 { echo "*** This log is abridged to its last $LOG_SIZE_THRESHOLD bytes"
384 echo
385 tail --bytes $LOG_SIZE_THRESHOLD $src
386 } > $dest
387 fi
388}
389
390# save-package-files creates a tree we can rsync
391# For EACH PACKAGE, without shards
392#
393# TODO: Both baseline and osh-as-sh should appear atomically?
394
395# Source tree:
396#
397# _chroot/package-layers/
398# baseline/
399# jq/
400# home/udu/
401# oils/_tmp/aports-guest/
402# jq.log.txt
403# jq.task.tsv
404# packages/main/x86_64
405# jq-*.apk
406# aports/main/jq/
407# src/jq-1.8.0/test-suite.log
408#
409# _tmp/aports-build/
410# 2025-11-12/
411# shard0/ # TODO: remove shards
412# baseline/
413# NEW:
414# apk/
415# jq.apk.txt # md5sum
416# layer/
417# jq.tombstone.txt # find '%s %P\n'
418# task/
419# jq.task.tsv
420# EXISTING:
421# apk.txt
422# tasks.tsv
423# log/
424# jq.log.txt
425# test-suite/
426# jq/ TODO: support multiple logs
427# test-suite.log
428
429save-package-files() {
430 ### Copy some files from _chroot/package-layers/ -> _tmp/aports-build
431
432 local config=${1:-baseline}
433 local a_repo=${2:-main}
434 local pkg=${3:-jq}
435
436 local layer_dir=_chroot/package-layers/$config/$pkg
437 local dest_dir=$BASE_DIR/$APORTS_EPOCH/$config
438
439 # 5 directories
440 mkdir -p $dest_dir/{apk,layer,task,log,test-suite}
441
442 cp \
443 $layer_dir/home/udu/oils/_tmp/aports-guest/$pkg.task.tsv \
444 $dest_dir/task
445
446 abridge-one-log \
447 $layer_dir/home/udu/oils/_tmp/aports-guest/$pkg.log.txt \
448 $dest_dir/log/$pkg.log.txt
449
450 # Abridge this log too
451 { find $layer_dir/home/udu/aports/$a_repo/$pkg -name 'test-suite.log' 2> /dev/null || true; } |
452 while read -r log_src; do
453 local test_suite_dest_dir=$dest_dir/test-suite/$pkg
454 mkdir -p $test_suite_dest_dir
455 abridge-one-log \
456 $log_src \
457 $test_suite_dest_dir/test-suite.log.txt
458 done
459
460 md5sum $layer_dir/home/udu/packages/$a_repo/x86_64/*.apk \
461 > $dest_dir/apk/$pkg.apk.txt 2> /dev/null || true # allow failure if nothing built
462
463 # Truncate large listings - e.g. clang packages have over 120K files
464 { find $layer_dir -printf '%s %P\n' 2> /dev/null || true; } |
465 head -n 1000 > $dest_dir/layer/$pkg.tombstone.txt
466
467 #tree $dest_dir
468
469 # log.txt
470 # log.txt
471}
472
473NUM_CORES=$(( $(nproc) ))
474
475# 2 cores per package build
476NUM_PAR=$(( NUM_CORES / 2 ))
477
478# over-subscribe - allow 20 processes to see 2 cores each
479# Note: this causes more timeouts. TODO: get rid of shards to get rid of
480# stragglers, and then raise the timeout to 20 minutes or more.
481# NUM_PAR=$(( NUM_CORES ))
482
483# TODO: we ran into the env.sh race condition in the enter-chroot script
484# generated by alpine-chroot-install
485build-many-packages-overlayfs() {
486 local package_filter=${1:-}
487 local config=${2:-baseline}
488 local a_repo=${3:-main}
489 local parallel=${4:-T}
490
491 banner "Building packages (filter=$package_filter a_repo=$a_repo)"
492
493 local -a flags
494 if test -n "$parallel"; then
495 log "(with $NUM_PAR jobs in parallel)"
496 flags=( -P $NUM_PAR )
497 else
498 log '(serially)'
499 fi
500
501 package-dirs "$package_filter" $a_repo |
502 xargs "${flags[@]}" -n 1 --process-slot-var=XARGS_SLOT -- \
503 $0 build-pkg $config $a_repo
504}
505
506
507clean-host-and-guest() {
508 # host dir _tmp/aports-build
509 rm -r -f -v $BASE_DIR
510}
511
512clean-guest() {
513 # clean guest chroot
514 sudo rm -r -f -v $CHROOT_HOME_DIR/oils/_tmp
515}
516
517readonly -a CONFIGS=( baseline osh-as-sh )
518
519APORTS_EPOCH="${APORTS_EPOCH:-}"
520# default epoch
521if test -z "$APORTS_EPOCH"; then
522 APORTS_EPOCH=$(date '+%Y-%m-%d')
523fi
524
525_build-many-configs-overlayfs() {
526 local package_filter=${1:-}
527 local epoch=${2:-$APORTS_EPOCH}
528 local a_repo=${3:-main}
529
530 if test -z "$package_filter"; then
531 die "Package filter is required (e.g. shard3, ALL)"
532 fi
533
534 clean-guest
535
536 # See note about /etc/sudoers.d at top of file
537
538 local dest_dir="$BASE_DIR/$epoch/$package_filter" # e.g. shard10
539
540 for config in "${CONFIGS[@]}"; do
541 banner "$epoch: Using config $config"
542
543 build-many-packages-overlayfs "$package_filter" "$config" "$a_repo"
544 done
545}
546
547remove-shard-files() {
548 local shard_dir=${1:-_chroot/shardC}
549
550 # For all packages packages, for baseline and osh-as-sh, clean up the aports source dir
551 # For linux, clang, etc. it becomes MANY GIGABYTES
552 #
553 # 2025-09-12: ignore errors from rm; I think there was a race condition -
554 # processes could still be running and creating files
555 #
556 # rm: cannot remove '_chroot/shard6/baseline/llvm19/home/udu/aports/main/llvm19/src/llvm-project-19.1.7.src/build/lib': Directory not empty
557 # real 1041m46.464s
558
559 #log "Removing big files in shard $shard_dir"
560 #sudo rm -r -f $shard_dir/*/*/home/udu/aports/ || true
561
562 log "Removing all files in $shard_dir"
563 sudo rm -r -f $shard_dir || true
564}
565
566build-many-shards-overlayfs() {
567 sudo -k
568
569 local a_repo=${A_REPO:-main} # env var like $APORTS_EPOCH
570
571 # Clean up old runs
572 sudo rm -r -f _chroot/package-layers _chroot/shard* _chroot/disagree*
573
574 banner "$APORTS_EPOCH $a_repo: building shards: $*"
575
576 time for shard_name in "$@"; do
577 _build-many-configs-overlayfs "$shard_name" "$APORTS_EPOCH" "$a_repo"
578
579 # Move layer files to _chroot/shard10/{baseline,osh}/...
580 mv -v --no-target-directory _chroot/package-layers _chroot/$shard_name
581
582 # Make it rsync-able in _tmp/aports-build ($BASE_DIR)
583 make-shard-tree $shard_name $a_repo
584
585 # Remove big files
586 remove-shard-files _chroot/$shard_name
587
588 # TODO: we should publish and clean up after every PACKAGE, rather than
589 # each shard
590 done
591}
592
593build-and-proc-log() {
594 # Measure resource utilization
595 local proc_dir="$BASE_DIR/$APORTS_EPOCH/proc-log"
596 mkdir -v -p $proc_dir
597 regtest/proc_log.py --out-dir $proc_dir --sleep-secs 5 &
598 local proc_log_pid=$!
599
600 sleep 0.05 # prevent overlapping sudo prompt
601
602 build-many-shards-overlayfs "$@"
603
604 kill -s TERM $proc_log_pid
605 wc -l $proc_dir/*.txt
606}
607
608make-shard-tree() {
609 ### Put outputs in rsync-able format, for a SINGLE shard
610
611 # The dir structure is like this:
612 #
613 # _tmp/aports-build/
614 # 2025-09-10-overlayfs/
615 # shard0/
616 # baseline/
617 # apk.txt
618 # tasks.tsv
619 # log/
620 # gzip.log.txt
621 # xz.log.txt
622 # test-suite/ # autotools dir
623 # gzip/
624 # test-suite.log.txt
625 # osh-as-sh/
626 # apk.txt
627 # tasks.tsv
628 # log/
629 # gzip.log.txt
630 # xz.log.txt
631 # test-suite/
632 # gzip/
633 # test-suite.log.txt
634 # shard1/
635 # ...
636 # shard16/
637 # ...
638
639 local shard_name=$1
640 local a_repo=${2:-main}
641 local epoch=${3:-$APORTS_EPOCH}
642
643 local shard_dir=_chroot/$shard_name
644
645 for config in baseline osh-as-sh; do
646 local dest_dir=$BASE_DIR/$epoch/$shard_name/$config
647 mkdir -p $dest_dir
648 #ls -l $shard_dir/$config
649
650 # Four outputs
651 # 1) log.txt for each package
652 # 2) Optional test-suite.txt for each package
653 # 3) merged tasks.tsv
654 # - comes from .task.tsv
655 # 4) merged apk.txt
656 #
657 # So 3 and 4 should not be merged yet
658 #
659 # _tmp/aports-build/
660 # 2025-11-12/
661 # shardP/
662 # baseline/
663 # log/
664 # test-suite/
665 # apk.txt
666 # tasks.tsv
667 #
668 # We want to
669
670 time python3 devtools/tsv_concat.py \
671 $shard_dir/$config/*/home/udu/oils/_tmp/aports-guest/*.task.tsv > $dest_dir/tasks.tsv
672
673 # Allowed to fail if zero .apk are built
674 time md5sum $shard_dir/$config/*/home/udu/packages/$a_repo/x86_64/*.apk \
675 > $dest_dir/apk.txt 2> /dev/null || true
676
677 abridge-logs $shard_dir/$config $dest_dir
678
679 done
680}
681
682abridge-logs() {
683 local config_src_dir=${1:-_chroot/shardD/osh-as-sh}
684 local dest_dir=${2:-$BASE_DIR/shardD/osh-as-sh}
685
686 local log_dest_dir=$dest_dir/log
687 local test_suite_dest_dir=$dest_dir/test-suite
688 mkdir -p $log_dest_dir $test_suite_dest_dir
689
690 local threshold=$(( 500 * 1000 )) # 500 KB
691
692 # this assumes the build process doesn't create *.log.txt
693 # test-suite.log is the name used by the autotools test runner - we want to save those too
694 # ignore permission errors with || true
695 { find $config_src_dir -name '*.log.txt' -a -printf '%s\t%P\n' 2> /dev/null || true; } |
696 while read -r size path; do
697 local src=$config_src_dir/$path
698 # Remove text until last slash (shortest match)
699 # like $(basename $path) but in bash, for speed
700 local filename=${path##*/}
701 local dest=$log_dest_dir/$filename
702
703 if test "$size" -lt "$threshold"; then
704 cp -v $src $dest
705 else
706 # Bug fix: abriding to 1000 lines isn't sufficient. We got some logs
707 # that were hundreds of MB, with less than 1000 lines!
708 { echo "*** This log is abridged to its last 500 KB:"
709 echo
710 tail --bytes 500000 $src
711 } > $dest
712 fi
713 done
714
715 { find $config_src_dir -name 'test-suite.log' -a -printf '%P\n' 2> /dev/null || true; } |
716 while read -r path; do
717 local src=$config_src_dir/$path
718
719 # Remove text after the first slash (shortest match)
720 local package_name=${path%%/*}
721 local dest=$test_suite_dest_dir/$package_name/test-suite.log.txt
722
723 mkdir -p "$(dirname $dest)"
724 cp -v --no-target-directory $src $dest
725 done
726
727 # 500K threshold: 76 MB
728 du --si -s $log_dest_dir
729}
730
731demo-build() {
732 local pkg=${1:-gzip} # in shardA, uses many cores
733 local do_pin=${2:-}
734
735 local -a prefix
736 if test -n "$do_pin"; then
737 echo "*** Pinning to CPU 0 ***"
738 prefix=( taskset -c 0 )
739 fi
740
741 "${prefix[@]}" $CHROOT_DIR/enter-chroot -u udu sh -c '
742 pkg=$1
743
744 echo "nproc = $(nproc)"
745
746 cd oils
747 set -x
748
749 # Note the user / real ratio! How many cores did we use?
750 time regtest/aports-guest.sh build-one-package $pkg
751 ' dummy0 $pkg
752}
753
754test-taskset() {
755 local pkg=${1:-gzip} # in shardA, uses many cores
756
757 demo-build $pkg ''
758 demo-build $pkg T
759}
760
761test-proc-log() {
762 local out_dir=_tmp/proc-log
763 mkdir -p $out_dir
764
765 regtest/proc_log.py --out-dir $out_dir &
766 local pid=$!
767 sleep 3.1 # should get 3 entries
768 kill $pid
769 wc -l $out_dir/*.txt
770}
771
772task-five "$@"