TC(Decision::ALLOW, "org.tizen.test.dest_prefix.do org.tizen.test.dest_prefix.ao.ao"),
};
+struct Test test_send_to_nonexistent[]={
+ {Decision::DENY, ROOT, ROOT, "User::Shell", "no.such.destination", "/no/such/path",
+ "no.such.interface", "no_such_method", ldp_xml_parser::MessageType::METHOD_CALL}
+};
+
void test_print(const struct Test* t, Decision result) {
printf("uid = %lu, gid = %lu, label = %s, destination = %s, expected = %s, result = %s",
(unsigned long)t->user, (unsigned long)t->group, t->label, t->destination, DECISIONS[t->expected_result], DECISIONS[result]);
}
-template <typename DB>
-void send_prefix_test(const DB &db)
+template <typename DB, typename Array>
+void send_prefix_test(const DB &db, const Array &tests)
{
for (const auto &test : tests) {
KdbusBusNames names;
std::cout << "run: " << static_cast<double>(end - begin)/CLOCKS_PER_SEC << std::endl;
}
-void run_fb(const char *conf_file, bool verify, size_t count) {
+void run_fb(const char *conf_file, bool verify, size_t count, bool worst) {
Serializer serializer;
size_t size;
uint8_t *buff = serializer.serialize(conf_file, size);
storage.init(file);
printf("FLATBUFFERS:\n");
- run_x_times([&storage](){ send_prefix_test(storage); }, count);
+ if (!worst)
+ run_x_times([&storage](){ send_prefix_test(storage, tests); }, count);
+ else
+ run_x_times([&storage](){ send_prefix_test(storage, test_send_to_nonexistent); }, count);
}
-void run_tests(const char *conf_file, bool verify, size_t c) {
- run_fb(conf_file, verify, c);
+void run_tests(const char *conf_file, bool verify, size_t c, bool worst) {
+ run_fb(conf_file, verify, c, worst);
}
void print_help(const char *name) {
static const struct option options[] {
{"system", no_argument, 0, 0},
- {"session", no_argument, 0, 0}
+ {"session", no_argument, 0, 0},
+ {nullptr, 0, nullptr, 0}
};
int main(int argc, char *argv[])
std::string input_filename = system_bus_conf_file_primary();
size_t count = 100;
bool verify = false;
+ bool worst = false;
while (1) {
int option_index;
- c = getopt_long(argc, argv, "vc:", options, &option_index);
+ c = getopt_long(argc, argv, "vwc:", options, &option_index);
if (c == -1)
break;
switch(c) {
case 'v':
verify = true;
break;
+ case 'w':
+ worst = true;
+ break;
}
}
}
tslog::init();
- run_tests(input_filename.c_str(), verify, count);
+ run_tests(input_filename.c_str(), verify, count, worst);
return 0;
}