Skip to content

Commit

Permalink
Makefile: add testcases to test target
Browse files Browse the repository at this point in the history
  • Loading branch information
rouseabout committed Jan 3, 2025
1 parent 47a9ec5 commit 8dd37f4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,9 @@ test:: $(HEAPTEST_BIN)
$(HEAPTEST_BIN): libc/heap.c libc/bsd_string.c
$(HOSTCC) $(HOSTCCFLAGS) -DTEST=1 -o $@ $^ -g

test:: kernel.linux initrd
$(QEMU) $(subst -debugcon stdio,,$(QEMUFLAGS)) -kernel kernel.linux -initrd initrd -append "init=/bin/testcases console=/dev/serial0" -nographic

clean-tests:
rf -f $(EXT2TEST_BIN) $(DUMPELF_BIN) $(DUMPEXT2_BIN) $(DUMPGPT_BIN) $(HEAPTEST_BIN)

Expand Down
9 changes: 9 additions & 0 deletions programs/testcases.c
Original file line number Diff line number Diff line change
Expand Up @@ -421,5 +421,14 @@ int main(int argc, char **argv, char ** envp)

printf("Tests complete\n");

if (getpid() == 1) {
int fd = open("/dev/power", O_WRONLY);
if (fd != -1) {
char value = 1;
write(fd, &value, sizeof(value));
close(fd);
}
}

return EXIT_SUCCESS;
}

0 comments on commit 8dd37f4

Please sign in to comment.