Skip to content

Commit 84de7f3

Browse files
authored
Merge pull request #210 from ryanbreen/feat/test-binary-reorg
Add /proc/breenix/testing and update ARM64 test suite paths
2 parents 46b9361 + 78885bb commit 84de7f3

File tree

2 files changed

+47
-4
lines changed

2 files changed

+47
-4
lines changed

docker/qemu/run-aarch64-test-suite.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ if [ "$1" = "--all" ]; then
3838
apk add --no-cache e2fsprogs >/dev/null 2>&1
3939
mkdir -p /mnt/ext2
4040
mount -o ro /ext2.img /mnt/ext2
41-
ls /mnt/ext2/bin/ | grep -E "_test$" | sort
41+
ls /mnt/ext2/usr/local/test/bin/ 2>/dev/null | grep -E "_test$|^test_" | sort
4242
' 2>/dev/null)
4343
elif [ -n "$1" ]; then
4444
TESTS="$@"
@@ -95,12 +95,12 @@ with open(kernel_src, 'r') as f:
9595
# Replace the path in run_userspace_from_ext2 call (handles both init_shell and bsh)
9696
content = re.sub(
9797
r'run_userspace_from_ext2\("/bin/(init_shell|bsh)"\)',
98-
f'run_userspace_from_ext2("/bin/{test_name}")',
98+
f'run_userspace_from_ext2("/usr/local/test/bin/{test_name}")',
9999
content
100100
)
101101
with open(kernel_src, 'w') as f:
102102
f.write(content)
103-
print(f"Modified kernel to load: /bin/{test_name}")
103+
print(f"Modified kernel to load: /usr/local/test/bin/{test_name}")
104104
PYTHON
105105

106106
# Build (with testing feature to enable exec() and other test syscalls)

kernel/src/fs/procfs/mod.rs

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ pub enum ProcEntryType {
7474
CowInfo,
7575
/// /proc/mounts - mounted filesystems
7676
Mounts,
77+
/// /proc/breenix - breenix info directory
78+
BreenixDir,
79+
/// /proc/breenix/testing - whether testing mode is active
80+
BreenixTesting,
7781
/// /proc/[pid] - per-process directory (dynamic, not registered)
7882
PidDir(u64),
7983
/// /proc/[pid]/status - per-process status (dynamic, not registered)
@@ -101,6 +105,8 @@ impl ProcEntryType {
101105
ProcEntryType::Stat => "stat",
102106
ProcEntryType::CowInfo => "cowinfo",
103107
ProcEntryType::Mounts => "mounts",
108+
ProcEntryType::BreenixDir => "breenix",
109+
ProcEntryType::BreenixTesting => "testing",
104110
ProcEntryType::PidDir(_) => "pid",
105111
ProcEntryType::PidStatus(_) => "status",
106112
}
@@ -126,6 +132,8 @@ impl ProcEntryType {
126132
ProcEntryType::Stat => "/proc/stat",
127133
ProcEntryType::CowInfo => "/proc/cowinfo",
128134
ProcEntryType::Mounts => "/proc/mounts",
135+
ProcEntryType::BreenixDir => "/proc/breenix",
136+
ProcEntryType::BreenixTesting => "/proc/breenix/testing",
129137
// Dynamic entries don't have static paths
130138
ProcEntryType::PidDir(_) => "/proc/<pid>",
131139
ProcEntryType::PidStatus(_) => "/proc/<pid>/status",
@@ -153,14 +161,19 @@ impl ProcEntryType {
153161
ProcEntryType::Stat => 6,
154162
ProcEntryType::CowInfo => 7,
155163
ProcEntryType::Mounts => 8,
164+
ProcEntryType::BreenixDir => 200,
165+
ProcEntryType::BreenixTesting => 201,
156166
ProcEntryType::PidDir(pid) => 10000 + pid,
157167
ProcEntryType::PidStatus(pid) => 20000 + pid,
158168
}
159169
}
160170

161171
/// Check if this is a directory
162172
pub fn is_directory(&self) -> bool {
163-
matches!(self, ProcEntryType::TraceDir | ProcEntryType::PidDir(_))
173+
matches!(
174+
self,
175+
ProcEntryType::TraceDir | ProcEntryType::BreenixDir | ProcEntryType::PidDir(_)
176+
)
164177
}
165178
}
166179

@@ -215,6 +228,10 @@ pub fn init() {
215228
procfs.entries.push(ProcEntry::new(ProcEntryType::CowInfo));
216229
procfs.entries.push(ProcEntry::new(ProcEntryType::Mounts));
217230

231+
// Register /proc/breenix directory and entries
232+
procfs.entries.push(ProcEntry::new(ProcEntryType::BreenixDir));
233+
procfs.entries.push(ProcEntry::new(ProcEntryType::BreenixTesting));
234+
218235
// Register /proc/trace directory and entries
219236
procfs.entries.push(ProcEntry::new(ProcEntryType::TraceDir));
220237
procfs.entries.push(ProcEntry::new(ProcEntryType::TraceEnable));
@@ -304,6 +321,7 @@ pub fn list_entries() -> Vec<String> {
304321
| ProcEntryType::TraceBuffer
305322
| ProcEntryType::TraceCounters
306323
| ProcEntryType::TraceProviders
324+
| ProcEntryType::BreenixTesting
307325
))
308326
.map(|e| String::from(e.entry_type.name()))
309327
.collect()
@@ -341,6 +359,17 @@ pub fn list_trace_entries() -> Vec<String> {
341359
.collect()
342360
}
343361

362+
/// List entries in the /proc/breenix directory
363+
pub fn list_breenix_entries() -> Vec<String> {
364+
let procfs = PROCFS.lock();
365+
procfs
366+
.entries
367+
.iter()
368+
.filter(|e| matches!(e.entry_type, ProcEntryType::BreenixTesting))
369+
.map(|e| String::from(e.entry_type.name()))
370+
.collect()
371+
}
372+
344373
/// Check if procfs is initialized
345374
pub fn is_initialized() -> bool {
346375
PROCFS.lock().initialized
@@ -373,6 +402,20 @@ pub fn read_entry(entry_type: ProcEntryType) -> Result<String, i32> {
373402
ProcEntryType::Stat => Ok(generate_stat()),
374403
ProcEntryType::CowInfo => Ok(generate_cowinfo()),
375404
ProcEntryType::Mounts => Ok(generate_mounts()),
405+
ProcEntryType::BreenixDir => {
406+
// Directory listing
407+
Ok(String::from("testing\n"))
408+
}
409+
ProcEntryType::BreenixTesting => {
410+
#[cfg(feature = "testing")]
411+
{
412+
Ok(String::from("1\n"))
413+
}
414+
#[cfg(not(feature = "testing"))]
415+
{
416+
Ok(String::from("0\n"))
417+
}
418+
}
376419
ProcEntryType::PidDir(pid) => Ok(generate_pid_dir(pid)),
377420
ProcEntryType::PidStatus(pid) => Ok(generate_pid_status(pid)),
378421
}

0 commit comments

Comments
 (0)