~thomas-voss/dbus-cpp/fix-packaging

« back to all changes in this revision

Viewing changes to tests/service_test.cpp

  • Committer: thomas-voss
  • Date: 2014-02-18 06:43:55 UTC
  • Revision ID: thomas.voss@canonical.com-20140218064355-ju0vvj81jdlbft7o
Adjust implementation of SigTermCatcher to use sigwait instead of signalfd's as qemu does not support signal fds.

Show diffs side-by-side

added added

removed removed

Lines of Context:
93
93
            std::thread t{[bus](){ bus->run(); }};
94
94
            cps1.try_signal_ready_for(std::chrono::milliseconds{500});
95
95
 
96
 
            sc.wait_for_signal_for(std::chrono::seconds{10});
 
96
            EXPECT_TRUE(sc.wait_for_signal());
97
97
 
98
98
            bus->stop();
99
99
 
110
110
            std::thread t{[bus](){ bus->run(); }};
111
111
            EXPECT_EQ(std::uint32_t(1), cps1.wait_for_signal_ready_for(std::chrono::milliseconds{500}));
112
112
 
113
 
            auto stub_service = dbus::Service::use_service(bus, dbus::traits::Service<test::Service>::interface_name());
 
113
            auto stub_service = dbus::Service::use_service<test::Service>(bus);
114
114
            auto stub = stub_service->object_for_path(dbus::types::ObjectPath("/this/is/unlikely/to/exist/Service"));
115
115
            EXPECT_EQ(stub->path().as_string(), "/this/is/unlikely/to/exist/Service");
116
116
            auto writable_property = stub->get_property<test::Service::Properties::Dummy>();
125
125
                received_signal_value = value;
126
126
                bus->stop();
127
127
            });
128
 
            auto result = stub->invoke_method_synchronously<test::Service::Method, int64_t>();
129
 
            EXPECT_FALSE(result.is_error());
130
 
            EXPECT_EQ(expected_value, result.value());
 
128
 
 
129
            try
 
130
            {
 
131
                auto result = stub->invoke_method_synchronously<test::Service::Method, int64_t>();
 
132
                EXPECT_FALSE(result.is_error());
 
133
                EXPECT_EQ(expected_value, result.value());
 
134
            } catch(const std::exception& e)
 
135
            {
 
136
                std::cout << e.what() << std::endl;
 
137
            }
 
138
            
131
139
            EXPECT_EQ(expected_value, writable_property->get());
132
140
            EXPECT_NO_THROW(writable_property->set(4242));
133
141
            EXPECT_EQ(4242, writable_property->get());