tools/bootconfig/test-bootconfig.sh
Source file repositories/reference/linux-study-clean/tools/bootconfig/test-bootconfig.sh
File Facts
- System
- Linux kernel
- Corpus path
tools/bootconfig/test-bootconfig.sh- Extension
.sh- Size
- 4429 bytes
- Lines
- 209
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: tools
- Status
- atlas-only
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
- No top-level syscall, struct, function, initcall, or export declaration detected by the generator.
Annotated Snippet
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-only
echo "Boot config test script"
if [ -d "$1" ]; then
TESTDIR=$1
else
TESTDIR=.
fi
BOOTCONF=${TESTDIR}/bootconfig
ALIGN=4
INITRD=`mktemp ${TESTDIR}/initrd-XXXX`
TEMPCONF=`mktemp ${TESTDIR}/temp-XXXX.bconf`
OUTFILE=`mktemp ${TESTDIR}/tempout-XXXX`
NG=0
cleanup() {
rm -f $INITRD $TEMPCONF $OUTFILE
exit $NG
}
trap cleanup EXIT TERM
NO=1
xpass() { # pass test command
echo "test case $NO ($*)... "
if ! ($@ && printf "\t\t[OK]\n"); then
printf "\t\t[NG]\n"; NG=$((NG + 1))
fi
NO=$((NO + 1))
}
xfail() { # fail test command
echo "test case $NO ($*)... "
if ! (! $@ && printf "\t\t[OK]\n"); then
printf "\t\t[NG]\n"; NG=$((NG + 1))
fi
NO=$((NO + 1))
}
echo "Basic command test"
xpass $BOOTCONF $INITRD
echo "Delete command should success without bootconfig"
xpass $BOOTCONF -d $INITRD
dd if=/dev/zero of=$INITRD bs=4096 count=1
printf "key = value;" > $TEMPCONF
bconf_size=$(wc -c < $TEMPCONF)
initrd_size=$(wc -c < $INITRD)
echo "Apply command test"
xpass $BOOTCONF -a $TEMPCONF $INITRD
new_size=$(wc -c < $INITRD)
echo "Show command test"
xpass $BOOTCONF $INITRD
echo "File size check"
total_size=$(expr $bconf_size + $initrd_size + 9 + 12 + $ALIGN - 1 )
total_size=$(expr $total_size / $ALIGN)
total_size=$(expr $total_size \* $ALIGN)
xpass test $new_size -eq $total_size
echo "Apply command repeat test"
xpass $BOOTCONF -a $TEMPCONF $INITRD
Annotation
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: atlas-only.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.