- Old tests fixed

- Added a static Fixuture class for test mockups
This commit is contained in:
2026-08-28 16:52:59 +02:00
parent 310218663d
commit 1ee2a2fe7a
13 changed files with 161 additions and 306 deletions
+4 -6
View File
@@ -15,8 +15,6 @@ import type { TreeNode } from "@core/filesystem/treenode";
import { getCurrentSession, type GroupInfo, type UserInfo } from "@core/session_manager";
import { createInitialShellState, type ShellState } from "@core/shell_state";
import { resolveInode } from "@core/util/path_resolver";
import { sortTreeNodes } from "@core/util/sort";
import { dnTraverseTree } from "@core/util/tree_traversal";
import { deserializeFileSystem } from "@shell/serializer";
import { Shell } from "@shell/shell";
import { printTree } from "./util/tree_visualizer";
@@ -50,10 +48,10 @@ groups.set(1000, group);
const state: ShellState = createInitialShellState(fs, users, groups, user);
await Shell.init(state);
console.log(resolveInode(Shell.Instance?.State!, 6));
console.log(resolveInode(Shell.Instance?.State!, 6, true));
//console.log(resolveInode(Shell.Instance?.State!, 6));
//console.log(resolveInode(Shell.Instance?.State!, 6, true));
console.log(sortTreeNodes(Shell.Instance?.State!, dnTraverseTree(Shell.Instance?.State.filesystem!, 0)));
//console.log(sortTreeNodes(Shell.Instance?.State!, dnTraverseTree(Shell.Instance?.State.filesystem!, 0)));
Shell.Instance?.on("result", payload => {
const decoded = new TextDecoder().decode(payload.result.stdout.toArray());
@@ -73,7 +71,7 @@ Shell.Instance?.on("result", payload => {
}); */
//console.clear();
process.stdout.write(resolveInode(Shell.Instance?.State!, getCurrentSession(state).cwd) + "\n> ");
process.stdout.write(resolveInode(state, getCurrentSession(state).cwd) + "\n> ");
process.stdin.on("data", async data => {
if (Shell.Instance?.BoundPID !== null) {
Shell.Instance?.sendInput(data.toString().trim());
+3 -1
View File
@@ -18,6 +18,7 @@ export class Process {
private readonly _MaxChunkByteSize: number;
readonly PID: number;
readonly Name: string;
readonly CommandDescriptor: CommandDescriptor;
readonly State: ShellState;
readonly Args: string[];
@@ -26,6 +27,7 @@ export class Process {
constructor(pid: number, state: ShellState, descriptor: CommandDescriptor, flags: string[], args: string[]) {
this.PID = pid;
this.State = state;
this.Name = descriptor.name;
this.CommandDescriptor = descriptor;
this.Flags = flags;
this.Args = args;
@@ -146,7 +148,7 @@ export class Process {
const result: ResultError<SignalTerminationError> = createErrorResult(
"SignalTermination",
`Process ${this.PID} killed by a ${signal.type}`,
`Process ${this.Name}(${this.PID}) killed by a ${SIGNAL_MAP[signal.type]}(${signal.type})`,
{ signalNumber: signal.type, signalName: SIGNAL_MAP[signal.type] },
this.CommandDescriptor.name,
);