LF OS
Hobby operating system for amd64 with high ambitions
Loading...
Searching...
No Matches
gtest_main.cxx
Go to the documentation of this file.
1#include <cstdio>
2#include <string>
3
4#include "gtest/gtest.h"
5
6#include <sys/syscalls.h>
7#include <sys/io.h>
8
9int main(int argc, char **argv) {
10 uint64_t error = 0;
11 // access to port where we write the result
12 sc_do_hardware_ioperm(0x1F05, 1, true, &error);
13 // access to keyboard controller to reset the system
14 sc_do_hardware_ioperm(0x60, 5, true, &error);
15
16 printf("Running main() from %s\n", __FILE__);
17 testing::InitGoogleTest(&argc, argv);
18
19 std::stringstream xml_report;
20 testing::XmlUnitTestResultPrinter xml_printer(&xml_report);
21 testing::UnitTest::GetInstance()->listeners().Append(&xml_printer);
22
23 int ret = RUN_ALL_TESTS();
24
25 std::string xml = xml_report.str();
26 for(auto it = xml.cbegin(); it != xml.cend(); it++) {
27 outb(0x1F05, *it);
28 }
29
30 // reset the system via keyboard controller
31 while(inb(0x64) & 2);
32 outb(0x64, 0xFE);
33
34 return ret;
35}
unsigned long uint64_t
Definition arch.h:14
int main(int argc, char **argv)
Definition gtest_main.cxx:9
static uint8_t inb(uint16_t port)
Definition io.h:18
static void outb(uint16_t port, uint8_t data)
Definition io.h:6
static uint16_t bool uint64_t * error
Definition syscalls.h:126