--- /dev/null
+
+--------------------------------------------------------------------------
+-- compliance_main.lua
+--------------------------------------------------------------------------
+
+package.path = package.path .. ";./../script/?.lua"
+package.path = package.path .. "~/tizen-sdk/test/script/?.lua"
+
+require "tclib"
+require "config"
+
+env = Env();
+env.modulepath = "~/tizen-sdk/tools/emulator/bin";
+env.emulator_manager_module = "emulator-manager.jar";
+env.vmname = config.emulatorinfo.vmname;
+
+env.report_dir = "../report/"; -- assume that has been created.
+
+-- add image path to here
+global_img_path = config.emulatorinfo.tizen_img_path;
+
+
+-- set test model object
+SetEnv(env);
+
+local script_path = "..//script//"
+
+-- test case lua file import
+
+dofile(script_path .. "tc_emulator_manager.lua")
+dofile(script_path .. "tc_compliance_web_ide.lua")
+dofile(script_path .. "tc_compliance_native_ide.lua")
+dofile(script_path .. "tc_compliance_da.lua")
+
+
+tclib.kill_emulator();
+
+-- call test case in each lua file's function
+prepare_compliance_check(env);
+
+test_compliance_web_ide(env);
+test_compliance_native_ide(env);
+test_compliance_da(env);
+
+tclib.kill_emulator();
+
+
+print("All test was completed");
+--
+--
--- /dev/null
+
+--------------------------------------------------------------------------
+-- config.lua
+--------------------------------------------------------------------------
+config={}
+
+config.emulatorinfo={}
+config.emulatorinfo.vmname = "created_from_lua"; -- set vm
+config.emulatorinfo.tizen_img_path= "~/tizen-sdk-data/emulator-vms/emulimg-created_from_lua.x86"
+
--------------------------------------------------------------------------
package.path = package.path .. ";./../script/?.lua"
+package.path = package.path .. "~/tizen-sdk/test/script/?.lua"
require "tclib"
local script_path = "..//script//"
-- test case lua file import
+
dofile(script_path .. "tc_emulator_manager.lua")
dofile(script_path .. "tc_network.lua")
dofile(script_path .. "tc_av.lua")
dofile(script_path .. "tc_compliance_native_ide.lua")
dofile(script_path .. "tc_compliance_da.lua")
+
tclib.kill_emulator();
-- call test case in each lua file's function
--test_emulator_manager(env);
-prepare_compliance_check(env);
+--prepare_compliance_check(env);
--test_network_check();
--test_audio_video();
--test_camera();
--test_event_injector();
-test_compliance_web_ide(env);
-test_compliance_native_ide(env);
-test_compliance_da(env);
+--test_compliance_web_ide(env);
+--test_compliance_native_ide(env);
+--test_compliance_da(env);
-tclib.kill_emulator();
+--tclib.kill_emulator();
--test_skinserver();
--
av_suite:AddTest(av_play);
- print("av test added");
-
av_suite:runTest();
return true;
--module(tclib, package.seeall)
tclib={}
+tclib.config={}
+tclib.config.pskill='.\\..\\tools\\windows\\pskill.exe'
+--tclib.config.pskill='C:\\MinGW\\msys\\1.0\\home\\dykim\\project\\emulator-test\\vts\\tools\\windows\\pskill.exe'
+function tclib.cmdlog(log)
+ io.stdout:write(log)
+ io.stdout:write('\n')
+ io.stdout:flush()
+end
+
+-- Don't use this function, can make problem
+function tclib.getos()
+ local fd = io.popen("ls -al", "r")
+ local osname = fd:read("*a")
+ fd:close();
+
+ if osname == null then
+ return "unknown"
+ end
+
+ if string.find(osname, "linux") ~= nil then
+ return "linux"
+ elseif string.find(osname, "MINGW") ~= nil then
+ return "windows"
+ else
+ return "mac"
+ end
+
+ return "unknown"
+end
+
+function tclib.execute(cmd)
+ local ret
+ tclib.cmdlog('-------------------------------------------------------------------------------')
+ tclib.cmdlog('?='..cmd)
+ ret = os.execute(cmd)
+ tclib.cmdlog('ret='..ret)
+ return ret
+end
+
function tclib.sleep(length)
local start = os.clock()
while os.clock() - start < length do end
end
-function tclib.kill_emulator()
+function tclib.kill_emulator_for_window()
+ print("[LUA] kill_emulator_for_window ...\n");
+ tclib.execute(tclib.config.pskill..' emulator-x86.exe')
- print("Killing the existing emulator process...\n");
+ local continue = true;
+ while continue == true do
+ local fd = io.popen("ps -a | grep emulator-x86");
+ local result = fd:read("*a");
+ print(result..'\n')
+ if string.find(result, "emulator-x86") == nil then
+ continue = false
+ print("emulator process does not exist\n")
+ end
+ fd:close();
+ end
+ print("Killed emulator\n");
+end
+
+function tclib.kill_emulator_for_linux()
+ print("[LUA] kill_emulator_for_linux ...\n");
os.execute("pkill emulator-x86");
local continue = true;
print("Killed emulator\n");
end
+function tclib.kill_emulator()
+ -- check os
+ --os = tclib.getos()
+ --if os == "windows" then
+ tclib.kill_emulator_for_window();
+ --else
+ -- tclib.kill_emulator_for_linux();
+ --end;
+end
+
+
lua_State *L = luaL_newstate();
// Provide the base libraries
- /*luaopen_base(L);
+ luaopen_base(L);
luaopen_table(L);
luaopen_string(L);
luaopen_math(L);
luaopen_debug(L);
luaopen_io(L);
luaopen_package(L);
-*/
+
luaL_openlibs(L);
// Provide user libraries
register_lua_funcs(L);
.method("AddParam2", &scmd::AddParam2)
.method("AddParamEX2", &scmd::AddParamEX2)
.method("SetTimeout", &scmd::SetTimeout)
- .method("SetSuccessToken", &scmd::SetSuccessToken);
+ .method("SetSuccessToken", &scmd::SetSuccessToken)
+ .method("runCmd", &scmd::runCmd);
m.subclass<sjava, scmd>("sjava")
void Finish();
void AddParam1(std::string name)
- {
+ {
cmdtest<CommandResultHandler>::AddParam(name);
- }
- void AddParam2(std::string name, std::string value)
- {
+ }
+ void AddParam2(std::string name, std::string value)
+ {
cmdtest<CommandResultHandler>::AddParam(name, value);
- }
+ }
- void AddParamEX1(std::string name)
- {
+ void AddParamEX1(std::string name)
+ {
cmdtest<CommandResultHandler>::AddParamEX(name);
}
void AddParamEX2(std::string name, std::string value)
- {
+ {
cmdtest<CommandResultHandler>::AddParamEX(name, value);
- }
+ }
+
+ std::string runCmd(const char* cmd)
+ {
+ SetCommand(cmd);
+ if (!Exec())
+ return "";
+ return m_resultstr;
+ }
};