diff --git a/README.md b/README.md index da86c42ab..deb19cc80 100755 --- a/README.md +++ b/README.md @@ -49,10 +49,10 @@ IncludeOS can currently not be built on macOS or Windows. A minimal IncludeOS "hello world" looks like a regular C++ program: ```c++ -#include +#include int main(){ - std::cout << "Hello world\n"; + std::println("Hello world"); } ``` diff --git a/src/kernel/kernel.cpp b/src/kernel/kernel.cpp index a6bfe1fdc..e882e74d0 100644 --- a/src/kernel/kernel.cpp +++ b/src/kernel/kernel.cpp @@ -85,16 +85,6 @@ void os::register_plugin(Plugin delg, const char* name){ plugins.emplace_back(delg, name); } -extern void __arch_reboot(); -void os::reboot() noexcept -{ - __arch_reboot(); -} -void os::shutdown() noexcept -{ - kernel::state().running = false; -} - void kernel::post_start() { // Enable timestamps (if present) diff --git a/src/kernel/os.cpp b/src/kernel/os.cpp index 2b27762b2..e1fed908a 100644 --- a/src/kernel/os.cpp +++ b/src/kernel/os.cpp @@ -16,6 +16,7 @@ #include #include +#include bool os::is_booted() noexcept { return kernel::is_booted(); @@ -24,6 +25,16 @@ const char* os::arch() noexcept { return Arch::name; } +void os::reboot() noexcept +{ + __arch_reboot(); +} + +void os::shutdown() noexcept +{ + kernel::state().running = false; +} + os::Panic_action os::panic_action() noexcept { return kernel::panic_action(); } diff --git a/src/kernel/service_stub.cpp b/src/kernel/service_stub.cpp index 215a67e48..e35e2b9a5 100644 --- a/src/kernel/service_stub.cpp +++ b/src/kernel/service_stub.cpp @@ -81,6 +81,8 @@ void Service::start(const std::string& cmd) int exit_status = main(argc, argv); INFO("main","returned with status %d", exit_status); #endif + + os::shutdown(); } __attribute__((weak)) diff --git a/test/integration/kernel/kprint/test.py b/test/integration/kernel/kprint/test.py index 1a2ec699c..079fd36e7 100755 --- a/test/integration/kernel/kprint/test.py +++ b/test/integration/kernel/kprint/test.py @@ -3,7 +3,6 @@ from __future__ import division from __future__ import print_function from builtins import str -from past.utils import old_div import sys import os @@ -27,7 +26,7 @@ def set_format_string_size(line): def check_truncation(line): assert(format_string_size) - print("Received truncated string: ", line, "of size", len(line), "(format size * ", old_div(len(line),format_string_size),")") + print("Received truncated string: ", line, "of size", len(line), "(format size * ", len(line)//format_string_size,")") assert(len(line) <= format_string_size * 2) # truncated outputs are unacceptable :) assert(line.strip().split(" ")[-1] == "END") diff --git a/test/integration/net/http/test.py b/test/integration/net/http/test.py index 5e0d61429..8e31b5ec0 100755 --- a/test/integration/net/http/test.py +++ b/test/integration/net/http/test.py @@ -1,19 +1,17 @@ #!/usr/bin/env python3 -from future import standard_library -standard_library.install_aliases() -from builtins import str -import sys -import os import _thread +import http.server +import sys +import urllib.error +import urllib.parse +import urllib.request from vmrunner import vmrunner HOST = '' PORT = 9011 -import http.server - DO_SERVE = True class RequestHandler(http.server.BaseHTTPRequestHandler): def do_GET(s): @@ -36,7 +34,6 @@ def Client_test(): _thread.start_new_thread(Client_test, ()) -import urllib.request, urllib.error, urllib.parse def Server_test(triggerline): res = urllib.request.urlopen("http://10.0.0.46:8080").read() assert(res.decode('utf-8') == "Hello") diff --git a/test/misc/lest_util/os_mock.cpp b/test/misc/lest_util/os_mock.cpp index e2576be7f..708d3e443 100644 --- a/test/misc/lest_util/os_mock.cpp +++ b/test/misc/lest_util/os_mock.cpp @@ -89,7 +89,6 @@ void kprint(const char* str) //void os::default_stdout(const char*, size_t) {} void os::event_loop() {} void os::halt() noexcept {} -void os::reboot() noexcept {} void __x86_init_paging(void*){}; namespace x86 {