Skip to content

Commit

Permalink
fix: truncate log file
Browse files Browse the repository at this point in the history
appending to the log file results
in tests being non-reproducible
  • Loading branch information
owl-from-hogvarts committed May 9, 2024
1 parent c354bb3 commit 4d93bf8
Show file tree
Hide file tree
Showing 4 changed files with 21,734 additions and 80,511 deletions.
2 changes: 1 addition & 1 deletion cpu/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ fn main() {
fn start() -> Result<(), Box<dyn Error>> {
let log_path = Path::new("cpu.log");
let log_output = OpenOptions::new()
.append(true)
.create(true)
.write(true)
.open(log_path)?;
let log_config = simplelog::ConfigBuilder::new()
.set_time_level(log::LevelFilter::Debug)
Expand Down
133 changes: 0 additions & 133 deletions tests/hello_username.yml
Original file line number Diff line number Diff line change
Expand Up @@ -191,139 +191,6 @@ out_log: |
Status: ZERO
MC Counter: 0

[INFO] Registers:
Accumulator: 0
Data: Command: Opcode: JUMP, operand: 1, mode: Relative
Command: Opcode: NOP, operand: 0, mode: None
Program counter: 1
Address: 0

Status: ZERO
MC Counter: 1

[INFO] Registers:
Accumulator: 0
Data: Command: Opcode: JUMP, operand: 1, mode: Relative
Command: Opcode: JUMP, operand: 1, mode: Relative
Program counter: 1
Address: 0

Status: ZERO
MC Counter: 2

[INFO] Registers:
Accumulator: 0
Data: Command: Opcode: JUMP, operand: 1, mode: Relative
Command: Opcode: JUMP, operand: 1, mode: Relative
Program counter: 1
Address: 2

Status: ZERO
MC Counter: 7

[INFO] Registers:
Accumulator: 0
Data: Command: Opcode: IN, operand: 0, mode: Immediate
Command: Opcode: JUMP, operand: 1, mode: Relative
Program counter: 1
Address: 2

Status: ZERO
MC Counter: 8

[INFO] Registers:
Accumulator: 0
Data: Command: Opcode: IN, operand: 0, mode: Immediate
Command: Opcode: JUMP, operand: 1, mode: Relative
Program counter: 2
Address: 2

Status: ZERO
MC Counter: 28

[INFO] Registers:
Accumulator: 0
Data: Command: Opcode: IN, operand: 0, mode: Immediate
Command: Opcode: JUMP, operand: 1, mode: Relative
Program counter: 2
Address: 2

Status: ZERO
MC Counter: 0

[INFO] Registers:
Accumulator: 0
Data: Command: Opcode: IN, operand: 0, mode: Immediate
Command: Opcode: JUMP, operand: 1, mode: Relative
Program counter: 3
Address: 2

Status: ZERO
MC Counter: 1

[INFO] Registers:
Accumulator: 0
Data: Command: Opcode: IN, operand: 0, mode: Immediate
Command: Opcode: IN, operand: 0, mode: Immediate
Program counter: 3
Address: 2

Status: ZERO
MC Counter: 2

[INFO] Registers:
Accumulator: 0
Data: Data(0)
Command: Opcode: IN, operand: 0, mode: Immediate
Program counter: 3
Address: 0

Status: ZERO
MC Counter: 4

[INFO] Registers:
Accumulator: 5
Data: Data(0)
Command: Opcode: IN, operand: 0, mode: Immediate
Program counter: 3
Address: 0

Status: ZERO
MC Counter: 13

[INFO] Registers:
Accumulator: 5
Data: Data(0)
Command: Opcode: IN, operand: 0, mode: Immediate
Program counter: 3
Address: 3

Status: ZERO
MC Counter: 0

[INFO] Registers:
Accumulator: 5
Data: Data(0)
Command: Opcode: IN, operand: 0, mode: Immediate
Program counter: 4
Address: 3

Status: ZERO
MC Counter: 1

[INFO] ================================================================================
[INFO] ================================================================================
[INFO] ================================================================================
[INFO] Registers:
Accumulator: 0
Data: Data(0)
Command: Opcode: NOP, operand: 0, mode: None
Program counter: 0
Address: 0

Status: ZERO
MC Counter: 0

[INFO] Registers:
Accumulator: 0
Data: Command: Opcode: JUMP, operand: 35, mode: Relative
Expand Down
Loading

0 comments on commit 4d93bf8

Please sign in to comment.