Skip to content

Commit 16ce2ce

Browse files
sjarmakclaude
andcommitted
feat: add build script for ccb-linux-base Docker images
Creates scripts/build_linux_base_images.sh which builds the 5 pre-built Docker images needed by linux fault-localization baseline tasks. Each image shallow-clones torvalds/linux at a specific kernel tag into /workspace with gcc:13, python3, and standard tools. Usage: ./scripts/build_linux_base_images.sh [v5.6.7|--list|...] Also updates the 5 linux Dockerfile comments to reference the new script path (was pointing to nonexistent ccb_linuxflbench/ directory). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 0259eaa commit 16ce2ce

File tree

6 files changed

+134
-15
lines changed

6 files changed

+134
-15
lines changed

benchmarks/ccb_debug/linux-acpi-backlight-fault-001/environment/Dockerfile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
# Pre-built base image contains gcc:13, tools, Claude Code CLI, and the
1+
# Pre-built base image contains gcc:13, python3, tools, and the
22
# Linux kernel source at v5.6.7. Build it first if missing:
3-
# ./benchmarks/ccb_linuxflbench/base_images/build_base_images.sh v5.6.7
4-
# See benchmarks/ccb_linuxflbench/README.md for details.
3+
# ./scripts/build_linux_base_images.sh v5.6.7
54
FROM ccb-linux-base:v5.6.7
65

76
# Tests are uploaded at runtime by Harbor verifier to /tests/

benchmarks/ccb_debug/linux-hda-intel-suspend-fault-001/environment/Dockerfile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
# Pre-built base image contains gcc:13, tools, Claude Code CLI, and the
1+
# Pre-built base image contains gcc:13, python3, tools, and the
22
# Linux kernel source at v3.7.6. Build it first if missing:
3-
# ./benchmarks/ccb_linuxflbench/base_images/build_base_images.sh v3.7.6
4-
# See benchmarks/ccb_linuxflbench/README.md for details.
3+
# ./scripts/build_linux_base_images.sh v3.7.6
54
FROM ccb-linux-base:v3.7.6
65

76
# Tests are uploaded at runtime by Harbor verifier to /tests/

benchmarks/ccb_debug/linux-iwlwifi-subdevice-fault-001/environment/Dockerfile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
# Pre-built base image contains gcc:13, tools, Claude Code CLI, and the
1+
# Pre-built base image contains gcc:13, python3, tools, and the
22
# Linux kernel source at v5.6-rc2. Build it first if missing:
3-
# ./benchmarks/ccb_linuxflbench/base_images/build_base_images.sh v5.6-rc2
4-
# See benchmarks/ccb_linuxflbench/README.md for details.
3+
# ./scripts/build_linux_base_images.sh v5.6-rc2
54
FROM ccb-linux-base:v5.6-rc2
65

76
# Tests are uploaded at runtime by Harbor verifier to /tests/

benchmarks/ccb_debug/linux-nfs-inode-revalidate-fault-001/environment/Dockerfile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
# Pre-built base image contains gcc:13, tools, Claude Code CLI, and the
1+
# Pre-built base image contains gcc:13, python3, tools, and the
22
# Linux kernel source at v4.1.15. Build it first if missing:
3-
# ./benchmarks/ccb_linuxflbench/base_images/build_base_images.sh v4.1.15
4-
# See benchmarks/ccb_linuxflbench/README.md for details.
3+
# ./scripts/build_linux_base_images.sh v4.1.15
54
FROM ccb-linux-base:v4.1.15
65

76
# Tests are uploaded at runtime by Harbor verifier to /tests/

benchmarks/ccb_debug/linux-ssd-trim-timeout-fault-001/environment/Dockerfile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
# Pre-built base image contains gcc:13, tools, Claude Code CLI, and the
1+
# Pre-built base image contains gcc:13, python3, tools, and the
22
# Linux kernel source at v4.14.114. Build it first if missing:
3-
# ./benchmarks/ccb_linuxflbench/base_images/build_base_images.sh v4.14.114
4-
# See benchmarks/ccb_linuxflbench/README.md for details.
3+
# ./scripts/build_linux_base_images.sh v4.14.114
54
FROM ccb-linux-base:v4.14.114
65

76
# Tests are uploaded at runtime by Harbor verifier to /tests/

scripts/build_linux_base_images.sh

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
#!/usr/bin/env bash
2+
# Build ccb-linux-base Docker images for the 5 Linux fault-localization tasks.
3+
#
4+
# Each image contains gcc:13, python3, standard tools, and the Linux kernel
5+
# source at a specific tag placed at /workspace.
6+
#
7+
# Usage:
8+
# ./scripts/build_linux_base_images.sh # build all 5
9+
# ./scripts/build_linux_base_images.sh v5.6.7 # build one
10+
# ./scripts/build_linux_base_images.sh --list # show required tags
11+
#
12+
# Time: ~5-10 minutes per image (shallow clone of Linux kernel).
13+
# Disk: ~1-2 GB per image.
14+
set -euo pipefail
15+
16+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
17+
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
18+
19+
# The 5 kernel version tags required by the ccb_debug linux tasks.
20+
# Tag → commit mapping (for reference, mirrors on sg-benchmarks):
21+
# v5.6.7 → 55b2af1c (linux-acpi-backlight-fault-001)
22+
# v3.7.6 → 07c4ee00 (linux-hda-intel-suspend-fault-001)
23+
# v5.6-rc2 → 11a48a5a (linux-iwlwifi-subdevice-fault-001)
24+
# v4.1.15 → 07cc49f6 (linux-nfs-inode-revalidate-fault-001)
25+
# v4.14.114 → fa5941f4 (linux-ssd-trim-timeout-fault-001)
26+
ALL_TAGS=(v5.6.7 v3.7.6 v5.6-rc2 v4.1.15 v4.14.114)
27+
28+
if [[ "${1:-}" == "--list" ]]; then
29+
echo "Required ccb-linux-base tags:"
30+
for tag in "${ALL_TAGS[@]}"; do
31+
exists=$(docker images -q "ccb-linux-base:$tag" 2>/dev/null)
32+
if [ -n "$exists" ]; then
33+
echo " ccb-linux-base:$tag [EXISTS]"
34+
else
35+
echo " ccb-linux-base:$tag [MISSING]"
36+
fi
37+
done
38+
exit 0
39+
fi
40+
41+
# Determine which tags to build
42+
if [ $# -gt 0 ]; then
43+
TAGS=("$@")
44+
else
45+
TAGS=("${ALL_TAGS[@]}")
46+
fi
47+
48+
# Create a temporary Dockerfile
49+
TMPDIR=$(mktemp -d)
50+
trap 'rm -rf "$TMPDIR"' EXIT
51+
52+
cat > "$TMPDIR/Dockerfile" <<'DOCKERFILE'
53+
FROM gcc:13
54+
55+
ARG KERNEL_TAG
56+
57+
RUN apt-get update && apt-get install -y --no-install-recommends \
58+
python3 \
59+
python3-pip \
60+
git \
61+
curl \
62+
ca-certificates \
63+
gawk \
64+
bc \
65+
bison \
66+
flex \
67+
libssl-dev \
68+
libelf-dev \
69+
&& rm -rf /var/lib/apt/lists/*
70+
71+
WORKDIR /workspace
72+
73+
# Shallow clone at the specific kernel tag — much faster than full clone.
74+
# The --no-tags flag avoids pulling all 1000+ kernel tags.
75+
RUN git clone --depth 1 --branch "$KERNEL_TAG" --no-tags \
76+
https://github.com/torvalds/linux.git . && \
77+
git config user.email "agent@example.com" && \
78+
git config user.name "Agent"
79+
80+
ENTRYPOINT []
81+
DOCKERFILE
82+
83+
echo "============================================"
84+
echo "Building ccb-linux-base images"
85+
echo "Tags to build: ${TAGS[*]}"
86+
echo "============================================"
87+
echo ""
88+
89+
FAILED=()
90+
for tag in "${TAGS[@]}"; do
91+
echo "---------- Building ccb-linux-base:$tag ----------"
92+
93+
# Check if already exists
94+
exists=$(docker images -q "ccb-linux-base:$tag" 2>/dev/null)
95+
if [ -n "$exists" ]; then
96+
echo " Image already exists ($(docker images --format '{{.Size}}' ccb-linux-base:$tag)). Skipping."
97+
echo " Use 'docker rmi ccb-linux-base:$tag' to force rebuild."
98+
echo ""
99+
continue
100+
fi
101+
102+
if docker build \
103+
--build-arg "KERNEL_TAG=$tag" \
104+
-t "ccb-linux-base:$tag" \
105+
-f "$TMPDIR/Dockerfile" \
106+
"$TMPDIR" ; then
107+
echo " OK: ccb-linux-base:$tag built successfully"
108+
echo " Size: $(docker images --format '{{.Size}}' ccb-linux-base:$tag)"
109+
else
110+
echo " FAILED: ccb-linux-base:$tag"
111+
FAILED+=("$tag")
112+
fi
113+
echo ""
114+
done
115+
116+
echo "============================================"
117+
echo "Summary:"
118+
echo " Requested: ${#TAGS[@]}"
119+
echo " Failed: ${#FAILED[@]}"
120+
if [ ${#FAILED[@]} -gt 0 ]; then
121+
echo " Failed tags: ${FAILED[*]}"
122+
exit 1
123+
fi
124+
echo "============================================"

0 commit comments

Comments
 (0)