static void check_mark(char *file, unsigned long long flag, char *flagstr, int expect, void (*test_event)(char *)) { if (myfanotify_mark(fd_notify, FAN_MARK_ADD | flag, FAN_OPEN, AT_FDCWD, file) != expect) { tst_resm(TFAIL, "fanotify_mark (%d, FAN_MARK_ADD | %s, FAN_OPEN, AT_FDCWD, " "'%s') %s", fd_notify, flagstr, file, expect_str_fail(expect)); } else { tst_resm(TPASS, "fanotify_mark (%d, FAN_MARK_ADD | %s, FAN_OPEN, AT_FDCWD, " "'%s') %s", fd_notify, flagstr, file, expect_str_pass(expect)); /* If we expected failure there's nothing to clean up */ if (expect == -1) return; if (test_event) test_event(file); if (myfanotify_mark(fd_notify, FAN_MARK_REMOVE | flag, FAN_OPEN, AT_FDCWD, file) < 0) { tst_brkm(TBROK | TERRNO, cleanup, "fanotify_mark (%d, FAN_MARK_REMOVE | %s, " "FAN_OPEN, AT_FDCWD, '%s') failed", fd_notify, flagstr, file); } } }
int runstltest2() { TFile *_file0 = TFile::Open("stl_example.root"); //int load_result = gSystem->Load("stltest/stltest.so"); //if (load_result) {return load_result;} return test_event(); }
static void* event_loop(void* arg) { event_block_t* block; event_t* event = 0; FOUNDATION_UNUSED(arg); event_stream_set_beacon(system_event_stream(), &thread_self()->beacon); while (!_test_should_terminate) { block = event_stream_process(system_event_stream()); event = 0; while ((event = event_next(block, event))) { switch (event->id) { case FOUNDATIONEVENT_START: #if FOUNDATION_PLATFORM_IOS || FOUNDATION_PLATFORM_ANDROID || FOUNDATION_PLATFORM_PNACL log_debug(HASH_TEST, STRING_CONST("Application start event received")); _test_should_start = true; #endif break; case FOUNDATIONEVENT_TERMINATE: #if FOUNDATION_PLATFORM_IOS || FOUNDATION_PLATFORM_ANDROID || FOUNDATION_PLATFORM_PNACL log_debug(HASH_TEST, STRING_CONST("Application stop/terminate event received")); _test_should_terminate = true; break; #else log_warn(HASH_TEST, WARNING_SUSPICIOUS, STRING_CONST("Terminating tests due to event")); process_exit(-2); #endif case FOUNDATIONEVENT_FOCUS_GAIN: _test_have_focus = true; break; case FOUNDATIONEVENT_FOCUS_LOST: _test_have_focus = false; break; default: break; } test_event(event); } thread_wait(); } log_debug(HASH_TEST, STRING_CONST("Application event thread exiting")); return 0; }
/*===========================================================================* * main * *===========================================================================*/ int main(void) { errct = 0; th_a = th_b = th_c = th_d = th_e = th_f = th_g = th_h = 0; mutex_a_step = mutex_b_step = mutex_c_step = 0; event_a_step = event_b_step = 0; rwlock_a_step = rwlock_b_step = 0; once = MTHREAD_ONCE_INIT; start(59); test_scheduling(); test_mutex(); test_event(); test_rwlock(); test_condition(); test_attributes(); test_keys(); quit(); return(0); /* Not reachable */ }
int main(int argc, char *argv[]) { int dev_from_class = 0, write_cnt; int fd; static struct sysfs_names *names; struct rc_device rc_dev; argp_parse(&argp, argc, argv, 0, 0, 0); /* Just list all devices */ if (!clear && !readtable && !keys.next && !ch_proto && !cfg.next && !test && !delay && !period) { if (devicename) { fd = open(devicename, O_RDONLY); if (fd < 0) { perror("Can't open device"); return -1; } device_info(fd, ""); close(fd); return 0; } if (show_sysfs_attribs(&rc_dev)) return -1; return 0; } if (cfg.next && (clear || keys.next || ch_proto || devicename)) { fprintf (stderr, "Auto-mode can be used only with --read, --debug and --sysdev options\n"); return -1; } if (!devicename) { names = find_device(devclass); if (!names) return -1; rc_dev.sysfs_name = names->name; if (get_attribs(&rc_dev, names->name)) { free_names(names); return -1; } names->name = NULL; free_names(names); devicename = rc_dev.input_name; dev_from_class++; } if (cfg.next) { struct cfgfile *cur; char *fname, *name; int rc; for (cur = &cfg; cur->next; cur = cur->next) { if ((!rc_dev.drv_name || strcasecmp(cur->driver, rc_dev.drv_name)) && strcasecmp(cur->driver, "*")) continue; if ((!rc_dev.keytable_name || strcasecmp(cur->table, rc_dev.keytable_name)) && strcasecmp(cur->table, "*")) continue; break; } if (!cur->next) { if (debug) fprintf(stderr, "Table for %s, %s not found. Keep as-is\n", rc_dev.drv_name, rc_dev.keytable_name); return 0; } if (debug) fprintf(stderr, "Table for %s, %s is on %s file.\n", rc_dev.drv_name, rc_dev.keytable_name, cur->fname); if (cur->fname[0] == '/' || ((cur->fname[0] == '.') && strchr(cur->fname, '/'))) { fname = cur->fname; rc = parse_keyfile(fname, &name); if (rc < 0) { fprintf(stderr, "Can't load %s table\n", fname); return -1; } } else { fname = malloc(strlen(cur->fname) + strlen(IR_KEYTABLE_USER_DIR) + 2); strcpy(fname, IR_KEYTABLE_USER_DIR); strcat(fname, "/"); strcat(fname, cur->fname); rc = parse_keyfile(fname, &name); if (rc != 0) { fname = malloc(strlen(cur->fname) + strlen(IR_KEYTABLE_SYSTEM_DIR) + 2); strcpy(fname, IR_KEYTABLE_SYSTEM_DIR); strcat(fname, "/"); strcat(fname, cur->fname); rc = parse_keyfile(fname, &name); } if (rc != 0) { fprintf(stderr, "Can't load %s table from %s or %s\n", cur->fname, IR_KEYTABLE_USER_DIR, IR_KEYTABLE_SYSTEM_DIR); return -1; } } if (!keys.next) { fprintf(stderr, "Empty table %s\n", fname); return -1; } clear = 1; } if (debug) fprintf(stderr, "Opening %s\n", devicename); fd = open(devicename, O_RDONLY); if (fd < 0) { perror(devicename); return -1; } if (dev_from_class) free(devicename); if (get_input_protocol_version(fd)) return -1; /* * First step: clear, if --clear is specified */ if (clear) { clear_table(fd); fprintf(stderr, "Old keytable cleared\n"); } /* * Second step: stores key tables from file or from commandline */ write_cnt = add_keys(fd); if (write_cnt) fprintf(stderr, "Wrote %d keycode(s) to driver\n", write_cnt); /* * Third step: change protocol */ if (ch_proto) { rc_dev.current = ch_proto; if (set_proto(&rc_dev)) fprintf(stderr, "Couldn't change the IR protocols\n"); else { fprintf(stderr, "Protocols changed to "); show_proto(rc_dev.current); fprintf(stderr, "\n"); } } /* * Fourth step: display current keytable */ if (readtable) display_table(&rc_dev, fd); /* * Fiveth step: change repeat rate/delay */ if (delay || period) { unsigned int new_delay, new_period; get_rate(fd, &new_delay, &new_period); if (delay) new_delay = delay; if (period) new_period = period; set_rate(fd, new_delay, new_period); } if (test) test_event(fd); return 0; }
int main(){ test_event(); return 0; }