diff --git a/repos/libports/run/stdcxx.run b/repos/libports/run/stdcxx.run new file mode 100644 index 000000000..265f6b357 --- /dev/null +++ b/repos/libports/run/stdcxx.run @@ -0,0 +1,35 @@ +assert_spec linux + +build "core init test/stdcxx" + +create_boot_directory + +install_config { + + + + + + + + + + + + + + + + + + +} + +build_boot_image { + core init test-stdcxx + ld.lib.so libc.lib.so libm.lib.so stdcxx.lib.so +} + +append qemu_args " -nographic -m 64 " + +run_genode_until ".*test-stdcxx finished.*\n" 10 diff --git a/repos/libports/src/test/stdcxx/main.cc b/repos/libports/src/test/stdcxx/main.cc new file mode 100644 index 000000000..8eac24946 --- /dev/null +++ b/repos/libports/src/test/stdcxx/main.cc @@ -0,0 +1,95 @@ +/* + * \brief Simple stdcxx regression tests + * \author Christian Helmuth + * \date 2015-05-28 + * + */ + +/* + * Copyright (C) 2015 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU General Public License version 2. + */ + +#include + +#include +#include +#include +#include + +static void test_string(double year, float month, unsigned long day) +{ + std::cout << std::to_string(year); + std::cout << " - "; + std::cout << std::to_string(month); + std::cout << " - "; + std::cout << std::to_string(day); + std::cout << std::endl; + + std::ostringstream buffer; + + buffer << std::fixed << std::setprecision(0); + buffer << year; + buffer << " - "; + buffer << month; + buffer << " - "; + buffer << day; + buffer << std::endl; + + std::cout << buffer.str(); +} + + +#include + +static void test_cstdlib() +{ + static ::lldiv_t o __attribute__((used)); + std::cout << std::strtoul("123", 0, 10) << std::endl; +} + + +#include + +static void test_stdexcept() +{ + try { + throw std::invalid_argument("INVALID"); + } catch (std::invalid_argument) { + std::cout << "catched std::invalid_argument"<< std::endl; + } +} + + +#include + +static void test_lock_guard() +{ +#if 0 + typedef std::mutex Mutex; +#else + struct Mutex + { + void lock() { } + void unlock() { } + }; +#endif + + Mutex lock; + std::lock_guard lock_guard(lock); +} + + +int main(int argc, char **argv) +{ + std::cout << "° °° °°° test-stdcxx started °°° °° °" << std::endl; + + test_string(2015, 5, 4); + test_cstdlib(); + test_stdexcept(); + test_lock_guard(); + + std::cout << "° °° °°° test-stdcxx finished °°° °° °" << std::endl; +} diff --git a/repos/libports/src/test/stdcxx/target.mk b/repos/libports/src/test/stdcxx/target.mk new file mode 100644 index 000000000..52a763630 --- /dev/null +++ b/repos/libports/src/test/stdcxx/target.mk @@ -0,0 +1,3 @@ +TARGET = test-stdcxx +SRC_CC = main.cc +LIBS = base stdcxx diff --git a/tool/autopilot.list b/tool/autopilot.list index 33537c7a4..6e5670a66 100644 --- a/tool/autopilot.list +++ b/tool/autopilot.list @@ -51,3 +51,4 @@ tz_vmm vmm bomb cpu_quota +stdcxx