Skip to content
Closed

blob #755

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions score/mw/com/impl/bindings/lola/proxy_method.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ score::Result<score::cpp::span<std::byte>> ProxyMethod::GetReturnValueBuffer(std

score::Result<void> ProxyMethod::DoCall(std::size_t queue_position)
{
std::cout << "DoCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaall" << std::endl;
if (!is_subscribed_)
{
score::mw::log::LogError("lola")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

#include <cstdint>
#include <exception>
#include <iostream>
#include <mutex>
#include <optional>
#include <utility>
Expand Down Expand Up @@ -392,6 +393,12 @@ auto ServiceDiscoveryClient::HandleEvents(

const auto& events = expected_events.value();

std::stringstream handle_events_log{};
handle_events_log << "\n\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n";
handle_events_log << "Inotify HandleEvents: received " << events.size() << " event(s) / pid=" << ::getpid();
handle_events_log << "\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n";
std::cout << handle_events_log.str() << std::endl;

std::vector<os::InotifyEvent> deletion_events{};
std::vector<os::InotifyEvent> creation_events{};
for (const auto& event : events)
Expand All @@ -403,6 +410,36 @@ auto ServiceDiscoveryClient::HandleEvents(
const bool inode_was_removed = search_directory_was_removed || flag_file_was_removed;
const bool inode_was_created = ReadMaskSet(event, os::InotifyEvent::ReadMask::kInCreate);

auto watch_descriptor = event.GetWatchDescriptor();
auto watch_iter = watches_.find(watch_descriptor);
if (watch_iter == watches_.end())
{
std::cout << "Received event for unknown watch descriptor: " << watch_descriptor.GetUnderlying()
<< std::endl;
}
auto watch = watch_iter->second;

auto path = GetSearchPathForIdentifier(watch.enriched_instance_identifier);

std::stringstream event_log{};
event_log << "Inotify event"
<< " / pid=" << ::getpid() << " / wd=" << event.GetWatchDescriptor().GetUnderlying() << " / mask=0x"
<< std::hex << static_cast<underlying_type_readmask>(event.GetMask()) << std::dec
<< " / name=" << event.GetName().data() << " / q_overflow=" << inotify_queue_overflowed
<< " / dir_removed=" << search_directory_was_removed << " / flag_removed=" << flag_file_was_removed;

if (filesystem_.standard->Exists(path).value())
{
event_log << " / removed_path=" << path;
}
else
{
event_log << " / removed_path=COULDNT FINT PATH";
};

event_log << " / created=" << inode_was_created;
std::cout << event_log.str() << std::endl;

if (inotify_queue_overflowed)
{
mw::log::LogError("lola")
Expand Down Expand Up @@ -459,7 +496,14 @@ auto ServiceDiscoveryClient::HandleDeletionEvents(const std::vector<os::InotifyE
continue;
}

const bool file_was_deleted = ReadMaskSet(event, os::InotifyEvent::ReadMask::kInDelete);
const bool file_only_was_deleted = ReadMaskSet(event, os::InotifyEvent::ReadMask::kInDelete);
const bool folder_was_deleted = ReadMaskSet(event, os::InotifyEvent::ReadMask::kInIgnored);
const bool file_was_deleted = file_only_was_deleted; // || folder_was_deleted;

std::cout << "\n\n8888888888888888888888888888888888888888888888888888888888888888888888888888888888\n";
std::cout << "File was deleted: " << file_only_was_deleted << '\n';
std::cout << "Folder was deleted: " << folder_was_deleted << '\n';
std::cout << "8888888888888888888888888888888888888888888888888888888888888888888888888888888888" << std::endl;

const auto& [enriched_instance_identifier, search_keys] = watch_iterator->second;
if (file_was_deleted)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,13 @@ score::Result<MethodReturnTypePtr<ReturnType>> ProxyMethod<ReturnType(ArgTypes..
auto allocated_return_type_storage = binding_->GetReturnValueBuffer(queue_position);
if (!allocated_return_type_storage.has_value())
{
score::mw::log::LogError("lola") << "Return value failed for the method: " << method_name_;
return Unexpected(allocated_return_type_storage.error());
}
auto call_result = binding_->DoCall(queue_position);
if (!call_result.has_value())
{
score::mw::log::LogError("lola") << "DoCall failed for method: " << method_name_;
return Unexpected(call_result.error());
}

Expand Down
2 changes: 1 addition & 1 deletion score/mw/com/test/methods/edge_cases_test/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ pkg_application(
],
etc = [
"config/disabled_methods_mw_com_config.json",
"config/logging.json",
# "config/logging.json",
"config/mw_com_config.json",
],
visibility = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,5 @@ integration_test(
# To be enabled on qnx once the bug is fixed or
# service discovery is reimplemented to not rely on
# inotify events (SWP-214271).
target_compatible_with = ["@platforms//os:linux"],
# target_compatible_with = ["@platforms//os:linux"],
)
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ int main(int argc, const char** argv)
}

score::mw::com::test::RunSkeletonRecreationWithNewProxyTest();
// std::this_thread::sleep_for(std::chrono::seconds{2});
score::mw::com::test::RunSkeletonRecreationWithSameProxyTest(stop_source.get_token());

return EXIT_SUCCESS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#include "score/mw/com/test/methods/methods_test_resources/all_signatures_datatype/all_signatures_method_consumer.h"

#include "score/mw/com/test/common_test_resources/fail_test.h"
#include <chrono>
#include <thread>

namespace score::mw::com::test
{
Expand Down Expand Up @@ -46,7 +48,7 @@ void AllSignaturesMethodConsumer::CallMethodWithInArgsAndReturn(const std::int32
auto allocated_args_result = proxy.with_in_args_and_return.Allocate();
if (!allocated_args_result.has_value())
{
std::cerr << "Consumer: Could not allocate method args: " << allocated_args_result.error() << std::endl;
std::cout << "Consumer: Could not allocate method args: " << allocated_args_result.error() << std::endl;
return Unexpected(allocated_args_result.error());
}

Expand All @@ -64,6 +66,7 @@ void AllSignaturesMethodConsumer::CallMethodWithInArgsAndReturn(const std::int32
}();
if (!call_result.has_value())
{
std::this_thread::sleep_for(std::chrono::seconds{2});
FailTest(failure_message_prefix, " Consumer: with_in_args_and_return call failed: ", call_result.error());
}
const auto return_value = *(call_result.value());
Expand Down
Loading