Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ef5d9819 authored by Mark Salyzyn's avatar Mark Salyzyn
Browse files

liblog: tests: liblog.__security property failure

CTS tests are failing to set ro.device_owner property.

Test: gTest liblog_unit_tests --gtest_filter=liblog.__security
Bug: 36480230
Change-Id: Icafea9f7488ce9c4ea47d42dc08505bc0cf99a3e
parent e941c5fa
Loading
Loading
Loading
Loading
+16 −2
Original line number Original line Diff line number Diff line
@@ -1854,8 +1854,22 @@ TEST(liblog, __security) {
    fprintf(stderr, "WARNING: setting ro.device_owner to a domain\n");
    fprintf(stderr, "WARNING: setting ro.device_owner to a domain\n");
    static const char domain[] = "com.google.android.SecOps.DeviceOwner";
    static const char domain[] = "com.google.android.SecOps.DeviceOwner";
    property_set(readonly_key, domain);
    property_set(readonly_key, domain);
    usleep(20000);  // property system does not guarantee performance, rest ...
    useconds_t total_time = 0;
    static const useconds_t seconds = 1000000;
    static const useconds_t max_time = 5 * seconds;  // not going to happen
    static const useconds_t rest = 20 * 1000;
    for (; total_time < max_time; total_time += rest) {
      usleep(rest);  // property system does not guarantee performance.
      property_get(readonly_key, readonly, nothing_val);
      property_get(readonly_key, readonly, nothing_val);
      if (!strcmp(readonly, domain)) {
        if (total_time > rest) {
          fprintf(stderr, "INFO: took %u.%06u seconds to set property\n",
                  (unsigned)(total_time / seconds),
                  (unsigned)(total_time % seconds));
        }
        break;
      }
    }
    EXPECT_STREQ(readonly, domain);
    EXPECT_STREQ(readonly, domain);
  } else if (!strcasecmp(readonly, "false") || !readonly[0]) {
  } else if (!strcasecmp(readonly, "false") || !readonly[0]) {
    // not enough permissions to run
    // not enough permissions to run