unsigned int test_lpf_mode(struct bladerf *dev, struct app_params *p, bool quiet) { unsigned int failures = 0; PRINT("%s: Setting and reading back RX LPF modes...\n", __FUNCTION__); failures += test_module(dev, BLADERF_MODULE_RX); PRINT("%s: Setting and reading back TX LPF modes...\n", __FUNCTION__); failures += test_module(dev, BLADERF_MODULE_TX); return failures; }
static int hellokernel_init(void) { printk("%s,%s,%d\n",__FILE__,__func__,__LINE__);//文件,函数名,所在行 test_module(); return 0; }
int main(int argc,char *argv[]) { int teststatus=0; int input; while((input = getopt_long (argc, argv, short_options, long_options, NULL)) != -1) { switch (input) { // 属于标准输出类函数 case 'h': str_help(); break; case 'v': printf("Smart7ec Scan Console %s\n",version); break; case 'l': str_list(); break; // 属于定制函数 case 'm': scan_mode = optarg; break; case 'f': find_modules = optarg; break; case 'u': scan_modules = optarg; break; case 't': teststatus = 1; break; case 'T': target = optarg; break; case 'b': baseline_testing(); break; } } // 查找模块模式 if (scan_mode != NULL && find_modules != NULL){ find_module(scan_mode,find_modules); } // 测试模块模式 if (scan_mode != NULL && scan_modules !=NULL && teststatus == 1){ test_module(scan_mode,scan_modules); } // 执行扫描测试 // for (path_index = 0; path_index < 3; path_index++) // { // char* this_path; // // 路径尾部组合 // char* path_last = splice("plugins/",splice(path[path_index],"/")); // // 全路径 // char* path_obj = splice(defpath(),path_last); // dirp = opendir(path_obj); // if(dirp != NULL) // { // while(1) // { // direntp = readdir(dirp); // if(direntp == NULL){ // break; // }else if(direntp->d_name[0] != '.'){ // analyres = (char*)analystr(direntp->d_name); // // 脚本解析器 // if (strcmp(analyres,"lua")==0){ // printf("[*] Lua work\n"); // // this_path = splice(path_obj,direntp->d_name); // // printf("Lua loading: %s \n",this_path); // // res=(int)verify_lua(this_path,2,"127.0.0.1",80); // // printf("Testing Lua result: %d\n",res); // }else if (strcmp(analyres,"py")==0){ // // printf("[*] Python plugin loading: %s \n",splice(path_obj,direntp->d_name)); // res=(int)verify_python(path_obj,direntp->d_name,1,argv[1],21); // printf("[*] Testing Python result: %d\n",res); // } // } // } // closedir(dirp); // } // } return 0; }
/*----------------------------------------------------------------------------*/ int testing(int mytesttype, char *module) { testtype = mytesttype; char pid[32] = ""; if( testtype == 0 ) { snprintf(pid, sizeof pid, "%d", getpid()); } printf("Pid is %s\n",pid); if (!module) { test_all(); test_module(TOPIARY_NTP_DRIFT); test_module(TOPIARY_PROC_BUDDYINFO); test_module(TOPIARY_PROC_CGROUPS); test_module(TOPIARY_PROC_CMDLINE); test_module(TOPIARY_PROC_CPUINFO); test_module(TOPIARY_PROC_DISKSTATS); test_module(TOPIARY_PROC_DOMAINNAME); test_module(TOPIARY_PROC_HOSTNAME); test_module(TOPIARY_PROC_INTERRUPTS); test_module(TOPIARY_PROC_LOADAVG); test_module(TOPIARY_PROC_MEMINFO); test_module(TOPIARY_PROC_MOUNTS); test_module(TOPIARY_PROC_NET_DEV); test_module(TOPIARY_PROC_NET_NETSTAT); test_module(TOPIARY_PROC_NET_RPC_NFS); test_module(TOPIARY_PROC_NET_RPC_NFSD); test_module(TOPIARY_PROC_NET_SNMP); test_module(TOPIARY_PROC_NET_SNMP6); test_module(TOPIARY_PROC_NET_SOCKSTAT); test_module(TOPIARY_PROC_OSRELEASE); test_module(TOPIARY_PROC_PARTITIONS); test_module(TOPIARY_PROC_PID_ENVIRON); test_pid_module(TOPIARY_PROC_PID_ENVIRON,pid); test_module(TOPIARY_PROC_PID_IO); test_pid_module(TOPIARY_PROC_PID_IO,pid); test_module(TOPIARY_PROC_PID_SMAPS); test_pid_module(TOPIARY_PROC_PID_SMAPS,pid); test_module(TOPIARY_PROC_PID_STAT); test_pid_module(TOPIARY_PROC_PID_STAT,pid); test_master_module(TOPIARY_PROC_PID_STAT, "chrome"); test_mod_module(TOPIARY_PROC_PID_STAT, "chrome", TOPIARY_PROC_PID_STATM); test_module(TOPIARY_PROC_PID_STATM); test_pid_module(TOPIARY_PROC_PID_STATM,pid); test_module(TOPIARY_PROC_PID_STATUS); test_pid_module(TOPIARY_PROC_PID_STATUS,pid); test_module(TOPIARY_PROC_SOFTIRQS); test_module(TOPIARY_PROC_STAT); test_module(TOPIARY_PROC_SYS_FS_FILE_NR); test_module(TOPIARY_PROC_UPTIME); test_module(TOPIARY_PROC_VMSTAT); /* later kernels (3.8?) do not have this.... * test_module(TOPIARY_SYS_CPUFREQ); */ test_module(TOPIARY_SYS_DISKSECTORS); test_glob_module(TOPIARY_SYS_DISKSECTORS, "sd*"); } else if (!strcmp(module, "all")) { test_all(); } else if (!strcmp(module, "ntp_drift")) { test_module(TOPIARY_NTP_DRIFT); } else if (!strcmp(module, "proc_buddyinfo")) { test_module(TOPIARY_PROC_BUDDYINFO); } else if (!strcmp(module, "proc_cgroups")) { test_module(TOPIARY_PROC_CGROUPS); } else if (!strcmp(module, "proc_cmdline")) { test_module(TOPIARY_PROC_CMDLINE); } else if (!strcmp(module, "proc_cpuinfo")) { test_module(TOPIARY_PROC_CPUINFO); } else if (!strcmp(module, "proc_diskstats")) { test_module(TOPIARY_PROC_DISKSTATS); } else if (!strcmp(module, "proc_domainname")) { test_module(TOPIARY_PROC_DOMAINNAME); } else if (!strcmp(module, "proc_hostname")) { test_module(TOPIARY_PROC_HOSTNAME); } else if (!strcmp(module, "proc_interrupts")) { test_module(TOPIARY_PROC_INTERRUPTS); } else if (!strcmp(module, "proc_loadavg")) { test_module(TOPIARY_PROC_LOADAVG); } else if (!strcmp(module, "proc_meminfo")) { test_module(TOPIARY_PROC_MEMINFO); } else if (!strcmp(module, "proc_mounts")) { test_module(TOPIARY_PROC_MOUNTS); } else if (!strcmp(module, "proc_net_dev")) { test_module(TOPIARY_PROC_NET_DEV); } else if (!strcmp(module, "proc_net_netstat")) { test_module(TOPIARY_PROC_NET_NETSTAT); } else if (!strcmp(module, "proc_net_rpc_nfs")) { test_module(TOPIARY_PROC_NET_RPC_NFS); } else if (!strcmp(module, "proc_net_rpc_nfsd")) { test_module(TOPIARY_PROC_NET_RPC_NFSD); } else if (!strcmp(module, "proc_net_snmp")) { test_module(TOPIARY_PROC_NET_SNMP); } else if (!strcmp(module, "proc_net_snmp6")) { test_module(TOPIARY_PROC_NET_SNMP6); } else if (!strcmp(module, "proc_net_sockstat")) { test_module(TOPIARY_PROC_NET_SOCKSTAT); } else if (!strcmp(module, "proc_osrelease")) { test_module(TOPIARY_PROC_OSRELEASE); } else if (!strcmp(module, "proc_partitions")) { test_module(TOPIARY_PROC_PARTITIONS); } else if (!strcmp(module, "proc_pid_environ")) { test_module(TOPIARY_PROC_PID_ENVIRON); test_pid_module(TOPIARY_PROC_PID_ENVIRON,pid); } else if (!strcmp(module, "proc_pid_io")) { test_module(TOPIARY_PROC_PID_IO); test_pid_module(TOPIARY_PROC_PID_IO,pid); } else if (!strcmp(module, "proc_pid_smaps")) { test_module(TOPIARY_PROC_PID_SMAPS); test_pid_module(TOPIARY_PROC_PID_SMAPS,pid); } else if (!strcmp(module, "proc_pid_stat")) { test_module(TOPIARY_PROC_PID_STAT); test_pid_module(TOPIARY_PROC_PID_STAT,pid); test_master_module(TOPIARY_PROC_PID_STAT, "chrome"); test_mod_module(TOPIARY_PROC_PID_STAT, "chrome", TOPIARY_PROC_PID_STATM); } else if (!strcmp(module, "proc_pid_statm")) { test_module(TOPIARY_PROC_PID_STATM); test_pid_module(TOPIARY_PROC_PID_STATM,pid); } else if (!strcmp(module, "proc_pid_status")) { test_module(TOPIARY_PROC_PID_STATUS); test_pid_module(TOPIARY_PROC_PID_STATUS,pid); } else if (!strcmp(module, "proc_softirqs")) { test_module(TOPIARY_PROC_SOFTIRQS); } else if (!strcmp(module, "proc_stat")) { test_module(TOPIARY_PROC_STAT); } else if (!strcmp(module, "proc_sys_fs_file_nr")) { test_module(TOPIARY_PROC_SYS_FS_FILE_NR); } else if (!strcmp(module, "proc_uptime")) { test_module(TOPIARY_PROC_UPTIME); } else if (!strcmp(module, "proc_vmstat")) { test_module(TOPIARY_PROC_VMSTAT); } else if (!strcmp(module, "sys_cpufreq")) { test_module(TOPIARY_SYS_CPUFREQ); } else if (!strcmp(module, "sys_disksectors")) { test_module(TOPIARY_SYS_DISKSECTORS); test_glob_module(TOPIARY_SYS_DISKSECTORS, "sd*"); } return 0; }
int main(int i_argc, char *ppsz_argv[]) { /* If b_test_all is true, this test could pollute the developer´s keystores */ bool b_test_all = i_argc > 1 && strcmp(ppsz_argv[1], "-a") == 0; if (!b_test_all) alarm(3); setenv("VLC_PLUGIN_PATH", "../modules", 1); /* Create a dummy libvlc to initialize module bank, needed by module_exists */ libvlc_instance_t *p_libvlc = libvlc_new(0, NULL); assert(p_libvlc != NULL); for (unsigned int i = 0; i < sizeof(keystore_args)/sizeof(*keystore_args); ++i) { const char *psz_module = keystore_args[i].psz_module; if ((b_test_all || keystore_args[i].b_test_default) && module_exists(psz_module)) { int i_vlc_argc = 1; char *ppsz_vlc_argv[2] = { 0 }; int i_tmp_fd = -1; char psz_tmp_path[] = "/tmp/libvlc_XXXXXX"; assert(asprintf(&ppsz_vlc_argv[0], "--keystore=%s,none", psz_module) != -1); if (strcmp(psz_module, "file") == 0) { assert((i_tmp_fd = mkstemp(psz_tmp_path)) != -1); printf("plaintext tmp file: '%s'\n", psz_tmp_path); assert(asprintf(&ppsz_vlc_argv[1], "--keystore-file=%s", psz_tmp_path) != -1); i_vlc_argc++; } else if (strcmp(psz_module, "kwallet") == 0) { /* See TODO in kwallet.cpp, VLCKWallet::connect() */ assert(libvlc_InternalAddIntf(p_libvlc->p_libvlc_int, "qt") == VLC_SUCCESS); } test_module(psz_module, b_test_all, keystore_args[i].b_persistent, i_vlc_argc, (const char * const *)ppsz_vlc_argv); if (i_tmp_fd != -1) { close(i_tmp_fd); unlink(psz_tmp_path); } free(ppsz_vlc_argv[0]); free(ppsz_vlc_argv[1]); } else printf("not testing %s\n", psz_module); } libvlc_release(p_libvlc); return 0; }
static void hellokernel_exit(void) { test_module(); printk("%s: goodbye kernel!\n", __FUNCTION__); }