-supported report that has compliance check format
authordaiyoung777.kim <daiyoung777.kim@samsung.com>
Sat, 1 Dec 2012 04:56:02 +0000 (13:56 +0900)
committerdaiyoung777.kim <daiyoung777.kim@samsung.com>
Sat, 1 Dec 2012 04:56:02 +0000 (13:56 +0900)
19 files changed:
vts/script/main.lua
vts/script/tc_emulator_manager.lua
vts/src/Report.cpp
vts/src/Report.h
vts/src/TcEM.cpp
vts/src/base.h
vts/src/main.cpp
vts/src/obj.cpp
vts/src/obj.h
vts/src/reportformat.h [new file with mode: 0644]
vts/src/smartptr.h
vts/src/sshell.cpp
vts/src/tcbase.cpp
vts/src/tcbase.h
vts/src/tccmd.cpp
vts/src/tccmd.h
vts/src/tcnetwork.cpp
vts/src/util.cpp
vts/src/util.h

index bd1d7b1..5bb872e 100644 (file)
@@ -11,12 +11,19 @@ env = Env();
 env.modulepath = "~/tizen-sdk/tools/emulator/bin";
 env.emulator_manager_module = "emulator-manager.jar";
 env.vmname = "created_from_lua";
+env.report_file_prefix_summary = "summary_";
+env.report_file_prefix_details = "details_";
 
+env.report_dir = "../report/";         -- assume that has been created.
+--env.modulepath = "/c/tizen-sdk/tools/emulator/bin";
 --env.modulepath = "c:\\tizen-sdk\\tools\\emulator\\bin";
 
+--model = TCModel();
+--model:SetEnv(env);
+--settcmodel(model);
 
-model = TCModel();
-model:SetEnv(env);
+-- set test model object
+SetEnv(env);
 
 local script_path = "..//script//"
 
@@ -31,21 +38,23 @@ dofile(script_path .. "tc_compliance_web_ide.lua")
 dofile(script_path .. "tc_compliance_native_ide.lua")
 
 
-tclib.kill_emulator();
+--tclib.kill_emulator();
 
 -- call test case in each lua file's function
 test_emulator_manager(env);
-test_network_check();
-test_audio_video();
+--test_network_check();
+--test_audio_video();
 --test_camera();
-test_event_injector();
+--test_event_injector();
 test_compliance_web_ide(env);
 test_compliance_native_ide(env);
 tclib.kill_emulator();
 
-test_skinserver();
---
+--test_skinserver();
 --
+---model:Stop();
+
+-
 print("All test was completed");
 -- 
 --
index 7adf7e7..95e229c 100644 (file)
@@ -33,26 +33,31 @@ function test_emulator_manager(env)
        local em_tst1 = TcEM_create("create_vm");
        local em_tst2 = TcEM_create_select_size_of_the_ram("create_select_ram");
        local em_tst3 = TcEM_create_select_resolution("create_select_res");
-       local em_tst4 = TcEM_create_select_display_density("create_select_disp");
-       local em_tst5 = TcEM_create_select_file_sharing("create_select_file_share");
-       local em_tst6 = TcEM_create_select_hw_virtualization("create_select_hw_vritualization");
-       local em_tst7 = TcEM_clone("clone");
+       --local em_tst4 = TcEM_create_select_display_density("create_select_disp");
+       --local em_tst5 = TcEM_create_select_file_sharing("create_select_file_share");
+       --local em_tst6 = TcEM_create_select_hw_virtualization("create_select_hw_vritualization");
+       --local em_tst7 = TcEM_clone("clone");
 
 
        em_suite = TsEM("emulator-manager-test");
        em_suite:AddTest(em_tst1);
        em_suite:AddTest(em_tst2);
        em_suite:AddTest(em_tst3);
-       em_suite:AddTest(em_tst4);
-       em_suite:AddTest(em_tst5);
-       em_suite:AddTest(em_tst6);
-       em_suite:AddTest(em_tst7);
+       --em_suite:AddTest(em_tst4);
+       --em_suite:AddTest(em_tst5);
+       --em_suite:AddTest(em_tst6);
+       --em_suite:AddTest(em_tst7);
        --
        --
 
+       -- emulator-manager create -n test -p <image path>
+
        -- add emulator launching test
-       add_launching_test(em_suite);
+       --add_launching_test(em_suite);
+
+       --model:Add(em_suite);
 
+       AddTestSuite(em_suite);
 
        em_suite:runTest();
 
index f889b45..12bb1f9 100644 (file)
@@ -4,27 +4,36 @@
 #include <iostream>
 #include <stdio.h>
 #include "util.h"
+#include "tcbase.h"
+#include "reportformat.h"
 
 #define __HTML_OUTPUT_FILE     "report.html"
 
+namespace te_test {
 //
-//HtmlFileReport
+//DetailReport
 //
-HtmlFileReport::HtmlFileReport(TCModel* model) : Report(model)
+DetailReport::DetailReport(TCModel* model) : Report(model)
 {
-       std::string filename, timestr;
-       make_timestamp(timestr);
+       std::string filename;
+
        filename = "..//report//";
-       filename.append(timestr);       
-       filename.append("_Report.html");        
-       m_fp = fopen(filename.c_str(), "wt");
+       filename.append(model->m_timestr);
+       filename.append("_Report.html");
 
+       m_fp = fopen(filename.c_str(), "wt");
+       if (m_fp == NULL)
+       {
+               printf("[ERROR] : fail to create html report\n");
+               return;
+       }
+       
        config_css();
        BeginTable();
        MakeColumnHeader();
 }
        
-HtmlFileReport::~HtmlFileReport()
+DetailReport::~DetailReport()
 {
        EndTable();
        if (m_fp)
@@ -40,7 +49,7 @@ font-weight: bold; \
 font-size: 11px; \
 color: #404040;} " 
 
-void HtmlFileReport::config_css()
+void DetailReport::config_css()
 {
        if (!m_fp)
                return;
@@ -53,21 +62,21 @@ void HtmlFileReport::config_css()
        fprintf(m_fp, "</style>\n");
 }
 
-void HtmlFileReport::BeginTable()
+void DetailReport::BeginTable()
 {
        if (!m_fp)
                return;
        fprintf(m_fp, "<table border=1 cellspacing=0>\n");
 }
 
-void HtmlFileReport::EndTable()
+void DetailReport::EndTable()
 {
        if (!m_fp)
                return;
        fprintf(m_fp, "</table>\n");
  }
 
-void HtmlFileReport::BeginRow(const int tclevel)
+void DetailReport::BeginRow(const int tclevel)
 {
        if (!m_fp)
                return;
@@ -83,7 +92,7 @@ void HtmlFileReport::BeginRow(const int tclevel)
        fprintf(m_fp, "<tr bgcolor=%s>\n", color.c_str());
 }
 
-void HtmlFileReport::EndRow()
+void DetailReport::EndRow()
 {
        if (!m_fp)
                return;
@@ -91,12 +100,12 @@ void HtmlFileReport::EndRow()
 }
 
 
-void HtmlFileReport::MakeColumnHeader()
+void DetailReport::MakeColumnHeader()
 {
        if (!m_fp)
                return;
 
-       std::string headerstr = "<tr class=\"tblHd\"><td>Test time</td><td>Category</td><td>Sub category</td><td>Test Case</td><td>TC Level</td><td>Result</td><td>Command</td><td>Output</td><td>Etc</td></tr>";
+       std::string headerstr = "<tr class=\"tblHd\"><td>Time</td><td>Category</td><td>Sub category</td><td>TCs</td><td>TC Level</td><td>Result</td><td>Command</td><td>Output</td><td>Etc</td></tr>";
 
        fprintf(m_fp, "%s\n", headerstr.c_str());
 }
@@ -120,22 +129,139 @@ void make_tclevel_str(const int tclevel, std::string& levelstr)
        }
 }
 
-void HtmlFileReport::Write(const int tclevel, tscptr cat, tscptr subcat, 
-                               tscptr tcname, bool issucc, tscptr cmd, tscptr output, tscptr etc)
+void DetailReport::Write(tscstr timestr, tscstr tclevelstr, const int tclevel, tscstr cat, tscstr subcat, 
+                               tscstr tcname, bool issucc, tscstr cmd, tscstr output, tscstr etc)
 {
        if (!m_fp)
                return;
        BeginRow(tclevel);
        
-       std::string timestr;
-       make_timestamp(timestr);        
-       std::string tclevelstr;
-       make_tclevel_str(tclevel, tclevelstr);
+       fprintf(m_fp, "<td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td><font color=%s</font></td><td><font size=2 color=navy>%s</font></td><td><font size=2 color=gray>%s</font></td><td>%s</td></tr>", 
+               timestr, cat, subcat, tcname, tclevelstr, issucc ? "blue>SUCCEED" : "red>FAILURE", cmd, output, etc);
+
+}
+
+//
+
+SummaryReport::SummaryReport(TCModel* model) : Report(model)
+{
+       std::string filename;
+
+       filename = "..//report//";
+       filename.append(model->m_timestr);
+       filename.append("_SummaryReport.html");
+
+       m_fp = fopen(filename.c_str(), "wt");
+       if (m_fp == NULL)
+       {
+               printf("[ERROR] : fail to create html report\n");
+               return;
+       }
+}
        
-       fprintf(m_fp, "<td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td><font color=%s</font></td><td><font size=2 color=navy>%s</font></td><td><font size=2 color=gray>%s</font></td><td>%s</td></tr>", timestr.c_str(), cat, subcat, tcname, tclevelstr.c_str(), issucc ? "blue>SUCCEED" : "red>FAILURE", cmd, output, etc);
+SummaryReport::~SummaryReport()
+{
+       if (m_fp)
+               fclose(m_fp);
+}
 
+void SummaryReport::Write(tscstr timestr, tscstr tclevelstr, const int tclevel, tscstr cat, tscstr subcat, 
+                               tscstr tcname, bool issucc, tscstr cmd, tscstr output, tscstr etc)
+{
+       if (!m_fp)
+               return;
 }
 
+void SummaryReport::Summarize()
+{
+       _PrintTitle();
+       _BeginTable();
+       _PrintColumnHeader();
+
+
+       TCLIST& tclist = m_model->GetTcList();
+
+       _S_FOR_NEXT(TCLIST, tclist, it)
+       {
+               smart_ptr<TC> tc = (*it);
+               if (!tc.valid())
+                       continue;
+               
+               _BeginRow();
+               __FPRINT_TC_ROW(m_fp, tc->GetName(), tc->GetTotCnt(), tc->GetSuccCnt(), tc->GetFailCnt(), tc->GetNotTested(), (tc->IsSucceed() ? "SUCCEED" : "FAILURE"));
+               _EndRow();
+       }
+
+       __FPRINT_TC_TOT_ROW(m_fp, m_model->m_tot_cnt, m_model->m_succ_cnt, m_model->m_fail_cnt, m_model->m_not_tested, (m_model->m_fail_cnt == 0) ? "SUCCEED" : "FAILED");   
+       
+       _EndTable();
+
+       _PrintSummary();
+}
+
+void SummaryReport::_PrintTitle()
+{
+       if (!m_fp)
+               return;
+
+       fprintf(m_fp, "%s",_TITLE_STR);
+
+}
+
+void SummaryReport::_PrintSummary()
+{
+       if (!m_fp)
+               return;
+
+
+       std::string linkstr;
+       linkstr = m_model->m_timestr;
+       linkstr.append("_Report.html");
+
+
+       __FPRINT_SUMMARY(m_fp,  m_model->m_fail_cnt == 0 ? "SUCCEED" : "FAILED", linkstr.c_str());
+
+       //fprintf(m_fp, _HTML_SUMMARY_STR, "FAILED");
+}
+
+void SummaryReport::_BeginTable()
+{
+       if (!m_fp)
+               return;
+
+       fprintf(m_fp, "<table border=1 cellpadding=0 cellspacing=0 \
+       class=\"MsoTableGrid\" style=\"BORDER-COLLAPSE: collapse; mso-border-alt: solid windowtext .5pt; mso-yfti-tbllook: 1184; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt\">");
+
+}
+
+void SummaryReport::_EndTable()
+{
+       if (!m_fp)
+               return;
+       fprintf(m_fp, "</table>\n");
+}
+
+void SummaryReport::_BeginRow()
+{
+       if (!m_fp)
+               return;
+       fprintf(m_fp, "<tr style=\"mso-yfti-irow: 1\">");
+}
+
+void SummaryReport::_EndRow()
+{
+       if (!m_fp)
+               return;
+       fprintf(m_fp, "</tr>\n");
+}
+void SummaryReport::_PrintColumnHeader()
+{
+       if (!m_fp)
+               return;
+       fprintf(m_fp, _HTML_COLUMNHEADER_STR);
+}
+
+
 //
 // StdOutReport
 //
@@ -149,19 +275,13 @@ StdOutReport::~StdOutReport()
 
 }
 
-void StdOutReport::Write(const int tclevel, tscptr cat, tscptr subcat, 
-                               tscptr tcname, bool issucc, tscptr cmd, tscptr output, tscptr etc)
+void StdOutReport::Write(tscstr timestr, tscstr tclevelstr, const int tclevel, tscstr cat, tscstr subcat, 
+                               tscstr tcname, bool issucc, tscstr cmd, tscstr output, tscstr etc)
 {
-       std::string timestr;
-       make_timestamp(timestr);        
-       std::string tclevelstr;
-       make_tclevel_str(tclevel, tclevelstr);
-       
-
     printf("\n\n\n");                                                                               
     printf("#---------------------------------------------------------------------------\n");       
     printf("#\n");                                                                                  
-    printf("@ time : %s \n", timestr.c_str());                                                   
+    printf("@ time : %s \n", timestr);                                                   
     printf("@ command : %s \n", cmd);                                                     
     printf("@ result : %s \n", (issucc) ? "SUCCEED" : "FAILURE");
     printf("@ stdout :\n%s \n", output);                                               
@@ -169,32 +289,43 @@ void StdOutReport::Write(const int tclevel, tscptr cat, tscptr subcat,
                                                                                                     
 }
 
+void StdOutReport::Summarize()
+{
+       printf("\n\n\n\n");                                                                               
+    printf("********************************************************************\n");
+       printf("*\tSummary :\n");
+    printf("*\n");
+       printf("*\tTotal : %d \n", m_model->m_tot_cnt);                         
+    printf("*\tSucceed : %d \n", m_model->m_succ_cnt);
+    printf("*\tFailure :%d \n", m_model->m_fail_cnt);
+       printf("*\tNot tested: %d \n", m_model->m_not_tested);
+       printf("*\n");
+       printf("*\tResult :%s \n", (m_model->m_fail_cnt == 0) ? "Succeed" : "Failure");
+       printf("*\n"); 
+    printf("********************************************************************\n\n");        
+}
+
 
 
 //
 // ReportMgr
 //
-ReportMgr::ReportMgr()
+ReportMgr::ReportMgr(TCModel* model)
 {
-       Add(new HtmlFileReport(GetTCModel()));
-       Add(new StdOutReport(GetTCModel()));
+       Add(tsnew DetailReport(model));
+       Add(tsnew SummaryReport(model));
+       Add(tsnew StdOutReport(model));
 }
 
 ReportMgr::~ReportMgr()
 {
-       std::cout << "~ReportMgr called" << std::endl;
        Destroy();
 }
 
 void ReportMgr::Destroy()
 {
-       while (m_list.size() > 0)
-       {
-               Report* p = m_list.front();
-               if (p)
-                       delete p;
-               m_list.pop_front();
-       }
+       Summarize();
+       m_list.clear();
 }
 
 void ReportMgr::Add(Report* report)
@@ -210,31 +341,45 @@ void ReportMgr::Remove(Report* report)
                m_list.erase(it);
 }
 
-void ReportMgr::Write(const int tclevel, tscptr cat,tscptr subcat, 
-                               tscptr tcname, bool issucc, tscptr cmd, tscptr output, tscptr etc)
+void ReportMgr::Write(const int tclevel, tscstr cat,tscstr subcat, 
+                               tscstr tcname, bool issucc, tscstr cmd, tscstr output, tscstr etc)
 {
-       __REPORT_LIST::iterator it;
-       for(it = m_list.begin(); it != m_list.end(); it++)
+       std::string timestr;
+       make_timestamp(timestr);        
+       std::string tclevelstr;
+       make_tclevel_str(tclevel, tclevelstr);
+
+       _S_FOR_NEXT(__REPORT_LIST, m_list, it)
        {
-               Report* report = (*it);
-               if (!report)
+               smart_ptr<Report> report = (*it);
+               if (!report.valid())
                        continue;
-               report->Write(tclevel, cat, subcat, tcname, issucc, cmd, output, etc);  
+               report->Write(timestr.c_str(), tclevelstr.c_str(), tclevel, cat, subcat, tcname, issucc, cmd, output, etc);     
        }
 }
 
+void ReportMgr::Summarize()
+{
+       _S_FOR_NEXT(__REPORT_LIST, m_list, it)
+       {
+               smart_ptr<Report> report = (*it);
+               if (!report.valid())
+                       continue;
+               report->Summarize();    
+       }
+
+}
 
 //
 //
-ReportMgr* GetReportMgr()
-{
-       static ReportMgr mgr;
-       return &mgr;
-}
 
-ReportMgr* CreateReportMgr()
+ReportMgr* CreateReportMgr(TCModel* model)
 {
-       ReportMgr* mgr = new ReportMgr;
-       return mgr;
+       smart_ptr<ReportMgr> rp = tsnew ReportMgr(model);
+       if (!rp.valid())
+               return tsnull;
+       return rp.detach();
 }
-//
+
+} // end of namespace
+
index d9a4c0d..2786363 100644 (file)
@@ -5,32 +5,39 @@
 #include <list>
 #include <string>
 #include "types.h"
-#include "tcbase.h"
+#include "obj.h"
+#include "base.h"
 
-using namespace te_test;
+namespace te_test {
 
+class TCModel;
 
 class Report
+       : public Ref
 {
 public:
        Report(TCModel* model) : m_model(model)
        {}      
 
-       virtual ~Report(){}
-       virtual void Write(const int tclevel, tscptr cat, tscptr subcat, 
-                               tscptr tcname, bool issucc, tscptr cmd, tscptr output, tscptr etc) = 0;
+       virtual void Write(tscstr timestr, tscstr tclevelstr, const int tclevel, tscstr cat, tscstr subcat, 
+                               tscstr tcname, bool issucc, tscstr cmd, tscstr output, tscstr etc) = 0;
+
+       virtual void Summarize(){};
 
        TCModel* m_model;
 };
 
-class HtmlFileReport : public Report
+class DetailReport
+       : public Report
 {
 public:
-       HtmlFileReport(TCModel* model);
-       ~HtmlFileReport();      
-       void Write(const int tclevel, tscptr cat, tscptr subcat, 
-                               tscptr tcname, bool issucc, tscptr cmd, tscptr output, tscptr etc);
+       DetailReport(TCModel* model);
+       ~DetailReport();        
+       void Write(tscstr timestr, tscstr tclevelstr, const int tclevel, tscstr cat, tscstr subcat, 
+                               tscstr tcname, bool issucc, tscstr cmd, tscstr output, tscstr etc);
 
+       void Summarize(){};
+private:
        void config_css();
        void BeginTable();
        void EndTable();
@@ -40,30 +47,62 @@ public:
        FILE* m_fp;
 };
 
-class StdOutReport : public Report
+class SummaryReport
+       : public Report
+{
+public:
+       SummaryReport(TCModel* model);
+       ~SummaryReport();       
+       void Write(tscstr timestr, tscstr tclevelstr, const int tclevel, tscstr cat, tscstr subcat, 
+                               tscstr tcname, bool issucc, tscstr cmd, tscstr output, tscstr etc);
+       void Summarize();
+
+private:
+       void _PrintTitle();
+       void _PrintSummary();
+
+       void _BeginTable();
+       void _EndTable();
+       void _BeginRow();
+       void _EndRow();
+       void _PrintColumnHeader();
+
+
+       FILE* m_fp;
+};
+
+
+class StdOutReport
+       : public Report
 {
 public:
        StdOutReport(TCModel* model);
        ~StdOutReport();        
        
-       void Write(const int tclevel, tscptr cat, tscptr subcat, 
-                               tscptr tcname, bool issucc, tscptr cmd, tscptr output, tscptr etc);
+       void Write(tscstr timestr, tscstr tclevelstr, const int tclevel, tscstr cat, tscstr subcat, 
+                               tscstr tcname, bool issucc, tscstr cmd, tscstr output, tscstr etc);
+
+       void Summarize();
 };
 
 //
 // ReportMgr
 //
 class ReportMgr
+       : public Ref
 {
 public:
-       ReportMgr();
+
+       ReportMgr(TCModel* model);
        ~ReportMgr();
        void Destroy();
-       typedef std::list<Report*> __REPORT_LIST;
-
-       void Write(const int tclevel, tscptr cat,tscptr subcat, 
-                               tscptr tcname, bool issucc, tscptr cmd, tscptr output, tscptr etc);
+       
+       void Write(const int tclevel, tscstr cat,tscstr subcat, 
+                               tscstr tcname, bool issucc, tscstr cmd, tscstr output, tscstr etc);
+       void Summarize();
 
+private:
+       typedef std::list< smart_ptr<Report> > __REPORT_LIST;
        void Add(Report* report);
        void Remove(Report* report);
 
@@ -71,8 +110,9 @@ public:
 };
 
 
-ReportMgr* GetReportMgr();
+ReportMgr* CreateReportMgr(TCModel* model);
+
 
-ReportMgr* CreateReportMgr();
+} // end of namesapce
 
 #endif
index 9b22362..b7474e4 100644 (file)
@@ -4,13 +4,14 @@
 // updated date : ...
 // comments : 
 ////////////////////////////////////////
-
-#include "TcEM.h"
 #include <stdio.h>
 #include <iostream>
 #include <map>
+
 #include "tccmd.h"
 #include "Report.h"
+#include "TcEM.h"
+
 
 namespace te_test {
 
index 086e785..fdcb3e8 100644 (file)
@@ -6,13 +6,13 @@
 #include "smartptr.h"
 #include <iostream>
 
-#ifdef _DEBUG
-#define _CRTDBG_MAP_ALLOC
-#include <crtdbg.h> 
+//#ifdef _DEBUG
+//#define _CRTDBG_MAP_ALLOC
+//#include <crtdbg.h> 
+//#define tsnew new
+//#else
 #define tsnew new
-#else
-#define tsnew new
-#endif
+//#endif
 
 #define tsdel delete
 #define tsdels delete[]
index f79a56f..ca60159 100644 (file)
@@ -39,9 +39,6 @@ void TestSS()
 
 int main(int argc, char** argv)
 {
-       //TestSS();
-       //return 0;
-
        std::cout << "param count = " << argc << std::endl;     
        char script[512];
        if (argc > 1 && argv[1])
@@ -90,9 +87,8 @@ int main(int argc, char** argv)
         return 1;
     }   
 
-
-       ReportMgr* mgr = GetReportMgr();
-       mgr->Destroy(); 
+       //ReportMgr* mgr = GetReportMgr();
+       //mgr->Destroy();       
 
     //lua_close(L);
        return 0;
@@ -132,23 +128,26 @@ void register_lua_funcs(lua_State *L)
                .constructor<void (*) ()>()
                .property_rw("modulepath", &Env::m_modulepath)
                .property_rw("emulator_manager_module", &Env::m_emulator_manager_module)
-               .property_rw("vmname", &Env::m_vmname);
+               .property_rw("vmname", &Env::m_vmname)
+               .property_rw("report_dir", &Env::m_report_dir)
+               .property_rw("report_file_prefix_summary", &Env::m_report_file_prefix_summary)
+               .property_rw("report_file_prefix_details", &Env::m_report_file_prefix_details);
 
 
        m.class_<TCModel>("TCModel")
                .constructor<void (*) ()>()
-               .method("SetEnv", &TCModel::SetEnv);
+               .method("SetEnv", &TCModel::SetEnv)
+               .method("Add", &TCModel::Add)
+               .method("Start", &TCModel::Start)
+               .method("Stop", &TCModel::Stop);
 
-       /*
-       m.class_<CommandResultHandler>("CommandResultHandler")
-               .constructor<void (*) ()>();
+       m.function("SetTCModel", &SetTCModel);
 
-       m.class_<CommandTest>("CommandTest")
-               .constructor<void (*) (const char *)>()
-               .method("AddParam", &scmd::AddParam)
-               .method("AddParamEX", &scmd::AddParamEX);
-       */
+       m.function("SetEnv", &SetEnv);
 
+       m.function("AddTestSuite", &AddTestSuite);
+       
+       
        m.class_<scmd>("scmd")
                .constructor<void (*) (const char *)>()
                .method("SetCommand", &scmd::SetCommand)
@@ -166,9 +165,6 @@ void register_lua_funcs(lua_State *L)
        m.subclass<ssdb, scmd>("ssdb")
                .constructor<void (*) (const char *)>();
 
-
-       //m.function("SetEM_Params", &SetEM_Params);
-
        // emulator manager
        m.subclass<TcEM_create, TC>("TcEM_create")
                .constructor<void (*) (const char *)>()
index 4cb3687..3df3aa7 100644 (file)
@@ -3,7 +3,13 @@
 #define _usedbg 0
 
 
+
+#ifdef WIN32
+#include <windows.h>
+
+#else
 // for x86 architecture
+#define LPLONG long*
 
 inline long InterlockedExchangeAdd( long* Addend, long Increment )
 {
@@ -51,7 +57,14 @@ inline long InterlockedExchange(long* volatile Target, long Value)
        return ReturnValue;
 } 
 
+#endif
+
+
+#define ts_interlocked_inc(v) \
+       InterlockedIncrement((LPLONG)v)
 
+#define ts_interlocked_dec(v) \
+       InterlockedDecrement((LPLONG)v)
 
 obj::obj()
 {
@@ -66,21 +79,19 @@ obj::~obj()
 
 tsint Ref::ref() const
 {
-       tsint refcnt = InterlockedIncrement((long*)&m_refcnt);
+       tsint refcnt = ts_interlocked_inc(&m_refcnt);
        if (_usedbg && refcnt == 1)
        {
-               //printf("ref init (%p)"), this);
        }
        return refcnt;
 }
 
 tsint Ref::unref() const
 {
-       tsint refcnt = InterlockedDecrement((long*)&m_refcnt);
+       tsint refcnt = ts_interlocked_dec(&m_refcnt);
        tsassert(refcnt >= 0);
        if (refcnt == 0)
        {
-               //printf(_T("unref destroy (%p)"), this);
                Ref* p = const_cast<Ref*>(this);
                p->_on_destroy();
        }
@@ -89,7 +100,7 @@ tsint Ref::unref() const
 
 tsint Ref::unref_nodel() const
 {
-       tsint refcnt = InterlockedDecrement((long*)&m_refcnt);
+       tsint refcnt = ts_interlocked_dec(&m_refcnt);
        tsassert(refcnt >= 0);
        return refcnt;
 }
index 1bdf142..be3a06e 100644 (file)
@@ -43,14 +43,14 @@ public: \
        virtual tsint unref() const \
        { return base::unref(); } \
 
-#define tsdec_ref() tsdec_ref_ex(ncl::Ref)
+#define tsdec_ref() tsdec_ref_ex(Ref)
 
 #define tsdec_ref_break() \
 public: \
        virtual tsint ref() const \
-       { tsbreak; return ncl::Ref::ref(); } \
+       { tsbreak; return Ref::ref(); } \
        virtual tsint unref() const \
-       { tsbreak; return ncl::Ref::unref(); } \
+       { tsbreak; return Ref::unref(); } \
 
 
 #endif
\ No newline at end of file
diff --git a/vts/src/reportformat.h b/vts/src/reportformat.h
new file mode 100644 (file)
index 0000000..d3b1afa
--- /dev/null
@@ -0,0 +1,226 @@
+#ifndef __reportformat_h__
+#define __reportformat_h__
+
+#define _TITLE_STR     "\
+<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\
+<html xmlns=\"http://www.w3.org/1999/xhtml\" >\
+<head>\
+    <title>Compliance Check Results</title>\
+    <style type=\"text/css\">\
+P {font-family:\"±¼¸²Ã¼\", arial; font-size:9pt;} \
+td {font-family:\"±¼¸²Ã¼\", arial; font-size:9pt;} \
+    </style> \
+</head> \
+<body> \
+    <p>\
+    </p>\
+    <p class=\"MsoNormal\">\
+        <b style=\"mso-bidi-font-weight: normal\"><span lang=\"EN-US\">Summary : Compliance\
+        Check Result for Emulator Image</span></b></p>\
+    <p class=\"MsoListParagraph\" \
+        style=\"TEXT-INDENT: -20pt; MARGIN-LEFT: 40pt; mso-para-margin-left: 0gd; mso-list: l1 level1 lfo2\">\
+        <span lang=\"EN-US\" style=\"FONT-FAMILY: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings\">\
+        <span style=\"mso-list: Ignore\">l<span style=\"FONT: 7pt 'Times New Roman'; font-size-adjust: none; font-stretch: normal\">\
+        </span></span></span><span lang=\"EN-US\">Target OS : ubuntu-32<o:p></o:p></span></p> \
+    <p>"
+
+
+
+#define _HTML_COLUMNHEADER_STR "\
+<tr style=\"mso-yfti-irow: 0; mso-yfti-firstrow: yes\">\
+                <td style=\"BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: windowtext 1pt solid; PADDING-BOTTOM: 0cm; PADDING-LEFT: 5.4pt; WIDTH: 115.75pt; PADDING-RIGHT: 5.4pt; BACKGROUND: rgb(217,217,217); BORDER-TOP: windowtext 1pt solid; BORDER-RIGHT: windowtext 1pt solid; PADDING-TOP: 0cm; mso-border-alt: solid windowtext .5pt; mso-background-themecolor: background1; mso-background-themeshade: 217\" \
+                    valign=\"top\" width=\"154\">\
+                    <p align=\"center\" class=\"MsoNormal\" style=\"TEXT-ALIGN: center; LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt\">\
+                        <b style=\"mso-bidi-font-weight: normal\"><span lang=\"EN-US\">Verification Module<o:p></o:p></span></b></p>\
+                </td>\
+                <td style=\"BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: medium none; PADDING-BOTTOM: 0cm; PADDING-LEFT: 5.4pt; WIDTH: 115.8pt; PADDING-RIGHT: 5.4pt; BACKGROUND: rgb(217,217,217); BORDER-TOP: windowtext 1pt solid; BORDER-RIGHT: windowtext 1pt solid; PADDING-TOP: 0cm; mso-border-alt: solid windowtext .5pt; mso-background-themecolor: background1; mso-background-themeshade: 217; mso-border-left-alt: solid windowtext .5pt\" \
+                    valign=\"top\" width=\"154\">\
+                    <p align=\"center\" class=\"MsoNormal\" style=\"TEXT-ALIGN: center; LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt\">\
+                        <b style=\"mso-bidi-font-weight: normal\"><span lang=\"EN-US\">Total TCs<o:p></o:p></span></b></p>\
+                </td>\
+                <td stle=\"BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: medium none; PADDING-BOTTOM: 0cm; PADDING-LEFT: 5.4pt; WIDTH: 115.8pt; PADDING-RIGHT: 5.4pt; BACKGROUND: rgb(217,217,217); BORDER-TOP: windowtext 1pt solid; BORDER-RIGHT: windowtext 1pt solid; PADDING-TOP: 0cm; mso-border-alt: solid windowtext .5pt; mso-background-themecolor: background1; mso-background-themeshade: 217; mso-border-left-alt: solid windowtext .5pt\" \
+                    valign=\"top\" width=\"154\">\
+                    <p align=\"center\" class=\"MsoNormal\" \
+                        style=\"TEXT-ALIGN: center; LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt\">\
+                        <b style=\"mso-bidi-font-weight: normal\"><span lang=\"EN-US\">Pass<o:p></o:p></span></b></p>\
+                </td>\
+                <td style=\"BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: medium none; PADDING-BOTTOM: 0cm; PADDING-LEFT: 5.4pt; WIDTH: 115.8pt; PADDING-RIGHT: 5.4pt; BACKGROUND: rgb(217,217,217); BORDER-TOP: windowtext 1pt solid; BORDER-RIGHT: windowtext 1pt solid; PADDING-TOP: 0cm; mso-border-alt: solid windowtext .5pt; mso-background-themecolor: background1; mso-background-themeshade: 217; mso-border-left-alt: solid windowtext .5pt\" \
+                    valign=\"top\" width=\"154\">\
+                    <p align=\"center\" class=\"MsoNormal\" \
+                        style=\"TEXT-ALIGN: center; LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt\">\
+                        <b style=\"mso-bidi-font-weight: normal\"><span lang=\"EN-US\">Fail<o:p></o:p></span></b></p>\
+                </td>\
+                <td style=\"BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: medium none; PADDING-BOTTOM: 0cm; PADDING-LEFT: 5.4pt; WIDTH: 115.8pt; PADDING-RIGHT: 5.4pt; BACKGROUND: rgb(217,217,217); BORDER-TOP: windowtext 1pt solid; BORDER-RIGHT: windowtext 1pt solid; PADDING-TOP: 0cm; mso-border-alt: solid windowtext .5pt; mso-background-themecolor: background1; mso-background-themeshade: 217; mso-border-left-alt: solid windowtext .5pt\" \
+                    valign=\"top\" width=\"154\">\
+                    <p align=\"center\" class=\"MsoNormal\" \
+                        style=\"TEXT-ALIGN: center; LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt\">\
+                        <b style=\"mso-bidi-font-weight: normal\"><span lang=\"EN-US\">Not Tested<o:p></o:p></span></b></p>\
+                </td>\
+                <td style=\"BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: medium none; PADDING-BOTTOM: 0cm; PADDING-LEFT: 5.4pt; WIDTH: 115.8pt; PADDING-RIGHT: 5.4pt; BACKGROUND: rgb(217,217,217); BORDER-TOP: windowtext 1pt solid; BORDER-RIGHT: windowtext 1pt solid; PADDING-TOP: 0cm; mso-border-alt: solid windowtext .5pt; mso-background-themecolor: background1; mso-background-themeshade: 217; mso-border-left-alt: solid windowtext .5pt\" \
+                    valign=\"top\" width=\"154\">\
+                    <p align=\"center\" class=\"MsoNormal\" \
+                        style=\"TEXT-ALIGN: center; LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt\">\
+                        <b style=\"mso-bidi-font-weight: normal\"><span lang=\"EN-US\">Final Result<o:p></o:p></span></b></p>\
+                </td>\
+            </tr>"
+
+
+
+#define _HTML_SUMMARY_STR "\
+ </p>\
+    <p class=\"MsoNormal\">\
+        <span lang=\"EN-US\"><o:p> </o:p></span>\
+    </p>\
+    <p class=\"MsoListParagraph\" \
+        style=\"TEXT-INDENT: -20pt; MARGIN-LEFT: 40pt; mso-para-margin-left: 0gd; mso-list: l0 level1 lfo1\">\
+        <span lang=\"EN-US\" \
+            style=\"FONT-FAMILY: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings\">\
+        <span style=\"mso-list: Ignore\">l<span \
+            style=\"FONT: 7pt 'Times New Roman'; font-size-adjust: none; font-stretch: normal\">\
+        </span></span></span><u><span lang=\"EN-US\" style=\"COLOR: rgb(0,0,0)\">Final \
+        Result : </span><b style=\"mso-bidi-font-weight: normal\"><span lang=\"EN-US\" \
+            style=\"LINE-HEIGHT: 115%%%; COLOR: rgb(255,0,0); FONT-SIZE: 12pt\">%s</span></b></u></p>\
+    <p class=\"MsoListParagraph\" \
+        style=\"TEXT-INDENT: -20pt; MARGIN-LEFT: 40pt; mso-para-margin-left: 0gd; mso-list: l0 level1 lfo1\">\
+        <span lang=\"EN-US\" \
+            style=\"FONT-FAMILY: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings\">\
+        <span style=\"mso-list: Ignore\">l<span \
+            style=\"FONT: 7pt 'Times New Roman'; font-size-adjust: none; font-stretch: normal\">\
+        </span></span></span><span lang=\"EN-US\">Click </span>\
+        <b style=\"mso-bidi-font-weight: normal\"><span lang=\"EN-US\" \
+            style=\"LINE-HEIGHT: 115%%%; COLOR: red; FONT-SIZE: 12pt\"><a href=%s>this link</a></span></b><span \
+            lang=\"EN-US\" style=\"COLOR: red\"> </span><span lang=\"EN-US\">which provides \
+        details of test results.<o:p></o:p></span></p>\
+    <p class=\"MsoListParagraph\" \
+        style=\"TEXT-INDENT: -20pt; MARGIN-LEFT: 40pt; mso-para-margin-left: 0gd; mso-list: l0 level1 lfo1\">\
+        <span lang=\"EN-US\" \
+            style=\"FONT-FAMILY: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings\">\
+        <span style=\"mso-list: Ignore\">l<span \
+            style=\"FONT: 7pt 'Times New Roman'; font-size-adjust: none; font-stretch: normal\">\
+        </span></span></span><span lang=\"EN-US\">If you have some problems with an \
+        emulator-test, you can contact us those are below.<o:p></o:p></span></p>\
+    <p class=\"MsoListParagraph\" \
+        style=\"TEXT-INDENT: -20pt; MARGIN-LEFT: 60pt; mso-para-margin-left: 0gd; mso-list: l0 level2 lfo1\">\
+        <span lang=\"EN-US\" \
+            style=\"FONT-FAMILY: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings\">\
+        <span style=\"mso-list: Ignore\">n<span \
+            style=\"FONT: 7pt 'Times New Roman'; font-size-adjust: none; font-stretch: normal\">\
+        </span></span></span><span lang=\"EN-US\">DA : ±èÁÖ¿µ ¼ö¼® Email : j0.kim@samsung.com </span></p>\
+    <p class=\"MsoListParagraph\" \
+        style=\"TEXT-INDENT: -20pt; MARGIN-LEFT: 60pt; mso-para-margin-left: 0gd; mso-list: l0 level2 lfo1\">\
+        <span lang=\"EN-US\" \
+            style=\"FONT-FAMILY: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings\">\
+        <span style=\"mso-list: Ignore\">n<span \
+            style=\"FONT: 7pt 'Times New Roman'; font-size-adjust: none; font-stretch: normal\">\
+        </span></span></span><span lang=\"EN-US\">WEB-IDE<o:p> : ±è°­È£ ¼ö¼® Email : kh5325.kim@samsung.com </o:p></span>\
+    </p>\
+    <p class=\"MsoListParagraph\" \
+        style=\"TEXT-INDENT: -20pt; MARGIN-LEFT: 60pt; mso-para-margin-left: 0gd; mso-list: l0 level2 lfo1\">\
+        <span lang=\"EN-US\" \
+            style=\"FONT-FAMILY: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings\">\
+        <span style=\"mso-list: Ignore\">n<span \
+            style=\"FONT: 7pt 'Times New Roman'; font-size-adjust: none; font-stretch: normal\">\
+        </span></span></span><span lang=\"EN-US\">NATIVE-IDE<o:p> : ±è°­È£ ¼ö¼® Email : kh5325.kim@samsung.com </o:p></span></p> \
+</body>\
+</html>"
+
+
+#define __FPRINT_SUMMARY(fp, retval01, link02) \
+       fprintf(fp, _HTML_SUMMARY_STR, retval01, link02)
+
+
+
+#define __HTML_TC_ROW_STR "\
+<td style=\"BORDER-BOTTOM: 1pt solid; BORDER-LEFT: 1pt solid; PADDING-BOTTOM: 0cm; PADDING-LEFT: 5.4pt; WIDTH: 115.75pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: medium none; BORDER-RIGHT: 1pt solid; PADDING-TOP: 0cm; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt\" \
+                    valign=\"top\" width=\"154\">\
+                    <p align=\"center\" class=\"MsoNormal\" \
+                        style=\"TEXT-ALIGN: center; LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt\">\
+                        <span lang=\"EN-US\">%s<o:p></o:p></span></p>\
+                </td>\
+                <td style=\"BORDER-BOTTOM: 1pt solid; BORDER-LEFT: medium none; PADDING-BOTTOM: 0cm; PADDING-LEFT: 5.4pt; WIDTH: 115.8pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: medium none; BORDER-RIGHT: 1pt solid; PADDING-TOP: 0cm; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt\" \
+                    valign=\"top\" width=\"154\">\
+                    <p align=\"center\" class=\"MsoNormal\" \
+                        style=\"TEXT-ALIGN: center; LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt\">\
+                        <span lang=\"EN-US\">%d<o:p></o:p></span></p>\
+                </td>\
+                <td style=\"BORDER-BOTTOM: 1pt solid; BORDER-LEFT: medium none; PADDING-BOTTOM: 0cm; PADDING-LEFT: 5.4pt; WIDTH: 115.8pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: medium none; BORDER-RIGHT: 1pt solid; PADDING-TOP: 0cm; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt\" \
+                    valign=\"top\" width=\"154\">\
+                    <p align=\"center\" class=\"MsoNormal\" \
+                        style=\"TEXT-ALIGN: center; LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt\">\
+                        <span lang=\"EN-US\">%d<o:p></o:p></span></p>\
+                </td>\
+                <td style=\"BORDER-BOTTOM: 1pt solid; BORDER-LEFT: medium none; PADDING-BOTTOM: 0cm; PADDING-LEFT: 5.4pt; WIDTH: 115.8pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: medium none; BORDER-RIGHT: 1pt solid; PADDING-TOP: 0cm; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt\" \
+                    valign=\"top\" width=\"154\">\
+                    <p align=\"center\" class=\"MsoNormal\" \
+                        style=\"TEXT-ALIGN: center; LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt\">\
+                        <span lang=\"EN-US\">%d<o:p></o:p></span></p>\
+                </td>\
+                <td style=\"BORDER-BOTTOM: 1pt solid; BORDER-LEFT: medium none; PADDING-BOTTOM: 0cm; PADDING-LEFT: 5.4pt; WIDTH: 115.8pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: medium none; BORDER-RIGHT: 1pt solid; PADDING-TOP: 0cm; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt\" \
+                    valign=\"top\" width=\"154\">\
+                    <p align=\"center\" class=\"MsoNormal\" \
+                        style=\"TEXT-ALIGN: center; LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt\">\
+                        <span lang=\"EN-US\">%d<o:p></o:p></span></p>\
+                </td>\
+                <td style=\"BORDER-BOTTOM: 1pt solid; BORDER-LEFT: medium none; PADDING-BOTTOM: 0cm; PADDING-LEFT: 5.4pt; WIDTH: 115.8pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: medium none; BORDER-RIGHT: 1pt solid; PADDING-TOP: 0cm; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt\" \
+                    valign=\"top\" width=\"154\">\
+                    <p align=\"center\" class=\"MsoNormal\" \
+                        style=\"TEXT-ALIGN: center; LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt\">\
+                        <b style=\"mso-bidi-font-weight: normal\"><span lang=\"EN-US\" \
+                            style=\"FONT-SIZE: 12pt\">%s<o:p></o:p></span></b></p>\
+                </td>"
+
+
+#define __FPRINT_TC_ROW(fp, module0, total1, pass2, fail3, nottested4, result5) \
+       fprintf(fp, __HTML_TC_ROW_STR, module0, total1, pass2, fail3, nottested4, result5)
+
+
+#define __HTML_TC_TOT_ROW_STR "\
+ <tr style=\"mso-yfti-irow: 4; mso-yfti-lastrow: yes\">\
+                <td style=\"BORDER-BOTTOM: 1pt solid; BORDER-LEFT: 1pt solid; PADDING-BOTTOM: 0cm; PADDING-LEFT: 5.4pt; WIDTH: 115.75pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: medium none; BORDER-RIGHT: 1pt solid; PADDING-TOP: 0cm; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt\" \
+                    valign=\"top\" width=\"154\">\
+                    <p align=\"center\" class=\"MsoNormal\" \
+                        style=\"TEXT-ALIGN: center; LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt\">\
+                        <b style=\"mso-bidi-font-weight: normal\"><span lang=\"EN-US\" \
+                            style=\"FONT-SIZE: 12pt\">Total<o:p></o:p></span></b></p>\
+                </td>\
+                <td style=\"BORDER-BOTTOM: 1pt solid; BORDER-LEFT: medium none; PADDING-BOTTOM: 0cm; PADDING-LEFT: 5.4pt; WIDTH: 115.8pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: medium none; BORDER-RIGHT: 1pt solid; PADDING-TOP: 0cm; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt\" \
+                    valign=\"top\" width=\"154\">\
+                    <p align=\"center\" class=\"MsoNormal\" \
+                        style=\"TEXT-ALIGN: center; LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt\">\
+                        <b style=\"mso-bidi-font-weight: normal\"><span lang=\"EN-US\" \
+                            style=\"FONT-SIZE: 12pt\">%d<o:p></o:p></span></b></p>\
+                </td>\
+                <td style=\"BORDER-BOTTOM: 1pt solid; BORDER-LEFT: medium none; PADDING-BOTTOM: 0cm; PADDING-LEFT: 5.4pt; WIDTH: 115.8pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: medium none; BORDER-RIGHT: 1pt solid; PADDING-TOP: 0cm; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt\" \
+                    valign=\"top\" width=\"154\">\
+                    <p align=\"center\" class=\"MsoNormal\" \
+                        style=\"TEXT-ALIGN: center; LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt\">\
+                        <b style=\"mso-bidi-font-weight: normal\"><span lang=\"EN-US\" \
+                            style=\"FONT-SIZE: 12pt\">%d<o:p></o:p></span></b></p>\
+                </td>\
+                <td style=\"BORDER-BOTTOM: 1pt solid; BORDER-LEFT: medium none; PADDING-BOTTOM: 0cm; PADDING-LEFT: 5.4pt; WIDTH: 115.8pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: medium none; BORDER-RIGHT: 1pt solid; PADDING-TOP: 0cm; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt\" \
+                    valign=\"top\" width=\"154\">\
+                    <p align=\"center\" class=\"MsoNormal\" \
+                        style=\"TEXT-ALIGN: center; LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt\">\
+                        <b style=\"mso-bidi-font-weight: normal\"><span lang=\"EN-US\" \
+                            style=\"COLOR: red; FONT-SIZE: 12pt\">%d<o:p></o:p></span></b></p>\
+                </td>\
+                <td style=\"BORDER-BOTTOM: 1pt solid; BORDER-LEFT: medium none; PADDING-BOTTOM: 0cm; PADDING-LEFT: 5.4pt; WIDTH: 115.8pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: medium none; BORDER-RIGHT: 1pt solid; PADDING-TOP: 0cm; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt\" \
+                    valign=\"top\" width=\"154\">\
+                    <p align=\"center\" class=\"MsoNormal\" \
+                        style=\"TEXT-ALIGN: center; LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt\">\
+                        <b style=\"mso-bidi-font-weight: normal\"><span lang=\"EN-US\" \
+                            style=\"FONT-SIZE: 12pt\">%d<span style=\"COLOR: red\"><o:p></o:p></span></span></b></p>\
+                </td>\
+                <td style=\"BORDER-BOTTOM: 1pt solid; BORDER-LEFT: medium none; PADDING-BOTTOM: 0cm; PADDING-LEFT: 5.4pt; WIDTH: 115.8pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: medium none; BORDER-RIGHT: 1pt solid; PADDING-TOP: 0cm; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt\" \
+                    valign=\"top\" width=\"154\">\
+                    <p align=\"center\" class=\"MsoNormal\" \
+                        style=\"TEXT-ALIGN: center; LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt\">\
+                        <b style=\"mso-bidi-font-weight: normal\"><span lang=\"EN-US\" \
+                            style=\"COLOR: red; FONT-SIZE: 12pt\">%s<o:p></o:p></span></b></p>\
+                </td>\
+            </tr>"
+
+
+#define __FPRINT_TC_TOT_ROW(fp, total1, pass2, fail3, nottested4, result5) \
+       fprintf(fp, __HTML_TC_TOT_ROW_STR, total1, pass2, fail3, nottested4, result5)
+#endif
\ No newline at end of file
index a10537d..8e7cf59 100644 (file)
@@ -2,6 +2,7 @@
 #define __smartptr_h__
 
 #include "reserved.h"
+#include <stdio.h>
 
 template<class T>
 class smart_ptr
@@ -149,13 +150,13 @@ public:
                return _ptr == tsnull;
        }
        inline bool valid() const
-       { 
-               return _ptr != tsnull
+       {
+               return (_ptr != tsnull)
        }
        //
        inline bool     safe() const
        {
-               return this != tsnull;
+               return (this != tsnull);
        }
        //
        inline smart_ptr& attach(T* ptr)
index 72d1227..9c17e85 100644 (file)
@@ -69,6 +69,7 @@ bool sshell::exec()
        int state;
 
        char buff[sshell::MAX_LINE];
+       printf("%s\n", m_cmd.c_str());
 
        fp = popen(m_cmd.c_str(), "r");
        if (fp == NULL)
@@ -78,11 +79,14 @@ bool sshell::exec()
                return false;
        }
 
-       while (fgets(buff, sshell::MAX_LINE, fp) != NULL)
+       while (!feof(fp))
        {
-               printf("%s", buff);
-       
-               m_output += buff;
+               while (fgets(buff, sshell::MAX_LINE, fp) != NULL)
+               {
+                       printf("%s", buff);
+
+                       m_output += buff;
+               }
        }
 
        state = pclose(fp);
index 3c830c4..61cdf4e 100644 (file)
@@ -6,26 +6,26 @@
 
 #include "tcbase.h"
 #include "Report.h"
+#include "util.h"
 
 
 namespace te_test {
 
-//
-// TestCase 
-//
-bool FormatStr(const char* fmt, va_list varg, std::string& retval)
+//TCModel* g_tcmodel;
+
+// TObj
+
+TObj::TObj(const char* name)
+                : m_bOptional(false), m_parent(NULL), m_tclevel(eTC_LEVEL_TESTCASE), 
+                m_bResult(false), m_name(name), m_desc("-"), 
+                m_tot_cnt(0), m_succ_cnt(0), m_fail_cnt(0), m_not_tested(0), m_RepeatCount(1)
 {
-       retval = "";
-       char buf[1024];
-       int ret = vsnprintf(buf, 1024, fmt, varg);
-       if (ret == -1)
-               return false;
-       buf[ret] = 0;
+       m_model = GetTCModel();
+}
 
-       retval = ret;
-       return true;
+TObj::~TObj()
+{
 }
-//
 
 void TObj::SetName(const char name)
 {
@@ -87,6 +87,25 @@ bool TObj::IsOptional() const
        return m_bOptional;
 }
 
+void TObj::write_report(const int tclevel, tscstr cat, tscstr subcat, tscstr tcname, bool issucc, tscstr cmd, tscstr output, tscstr etc)
+{
+       if (!m_model)
+               return;
+
+       if (tclevel == eTC_LEVEL_TESTCASE)
+       {
+               if (issucc)
+                       m_model->inc_succ_cnt();
+               else
+                       m_model->inc_fail_cnt();
+       }
+
+       ReportMgr* report = m_model->GetReportMgr();
+       if (!report)
+               return;
+       report->Write(tclevel, cat, subcat, tcname, issucc, cmd, output, etc);
+}
+
 
 //
 // TC implementations
@@ -95,7 +114,6 @@ bool TObj::IsOptional() const
 TC::TC(const char* name) : TObj(name)
 {
        SetLevel(eTC_LEVEL_TESTCASE);
-       m_model = GetTCModel();
 }
 
 TC::~TC()
@@ -107,6 +125,7 @@ void TC::Add(TObj* tc)
 {
        tc->SetParent(this);
        m_tclist.insert(m_tclist.end(), tc);
+       m_tot_cnt = m_tclist.size();
 }
 
 // todo : this code was not verified
@@ -116,6 +135,7 @@ void TC::Remove(TObj* tc)
        __TC_LIST::iterator it = std::find(m_tclist.begin(), m_tclist.end(), tc);
        if (it != m_tclist.end())
                m_tclist.erase(it);
+       m_tot_cnt = m_tclist.size();
 }
 
 TObj* TC::Get(int idx)
@@ -128,15 +148,17 @@ TObj* TC::Get(int idx)
 bool TC::Test()
 {
        Prepare();
-       ChildTest();
+
+       RunChild();
        
-       MakeResult();
+       _MakeResult();
        
        Finish();
+
        return m_bResult;
 }
 
-void TC::ChildTest()
+void TC::RunChild()
 {
        int i = 0;
        for (i = 0; i < m_RepeatCount; i++)
@@ -146,17 +168,23 @@ void TC::ChildTest()
                        TObj* tc = it->get();
                        if (tc)
                        {
+                               if (m_model)
+                                       m_model->OnStarted(tc);
+
                                bool ret = tc->Test();
                                if (ret)
-                                       m_ChildSuccessCount++;
+                                       m_succ_cnt++;
+                               else
+                                       m_fail_cnt++;
+
+                               if (m_model)
+                                       m_model->OnStopped(tc);
                        }
-               }       
-               m_CurrentPos++;
+               }
        }
-       m_CurrentPos = 0;
 }
 
-void TC::MakeResult()
+void TC::_MakeResult()
 {
        _S_FOR_NEXT(__TC_LIST, m_tclist, it)
        {
@@ -176,47 +204,40 @@ void TC::MakeResult()
                if (!ret)
                        break;
        }
-       //m_bResult = (m_tclist.size() == m_ChildSuccessCount) ? true : false;
-}
-
-void make_tc_names(const int tclevel, TObj* tc,  std::string& cat, std::string& subcat, std::string& tcname)
-{
-       if (tclevel == eTC_LEVEL_TESTSUITE)
-       {
-               cat = tc->GetName();
-               subcat = "-";
-               tcname = "-";
-       }
-       else if (tclevel == eTC_LEVEL_TESTCASE)
-       {
-               TObj* parent = tc->GetParent(); 
-               cat = (parent) ? parent->GetName() : tc->GetName();
-               subcat = tc->GetName();
-               tcname = tc->GetName();
-
-       }
-       else if (tclevel == eTC_LEVEL_METHOD)
-       {
-               TObj* parent = tc->GetParent();
-               TObj* grand = (parent) ? parent->GetParent() : NULL;
-               cat = (grand) ? grand->GetName() : "-";
-               subcat = (parent) ? parent->GetName() : "-";
-               tcname = tc->GetName();
-       }
 }
 
 void TC::Finish()
 {
+       m_tot_cnt = m_tclist.size();
+
        char outstr[512];
-       sprintf(outstr, "Total = %d, Success = %d, Failure = %d", 
-       m_tclist.size(), m_ChildSuccessCount, (m_tclist.size() - m_ChildSuccessCount));
+       sprintf(outstr, "Total = %d, Success = %d, Failure = %d", m_tot_cnt, m_succ_cnt, m_fail_cnt);
  
        std::string cat, subcat, tcname;
        make_tc_names(m_tclevel, this, cat, subcat, tcname);
 
-       ReportMgr* report = GetReportMgr();                                                         
-    if (report)                                                                                 
-       report->Write(m_tclevel, cat.c_str(), subcat.c_str(), m_name.c_str(), m_bResult, "-", outstr, m_desc.c_str());                                                                                     
+       write_report(m_tclevel, cat.c_str(), subcat.c_str(), m_name.c_str(), m_bResult, "-", outstr, m_desc.c_str());                                                                                     
+}
+
+// Env
+
+Env::Env()
+{
+       m_modulepath = "~/tizen-sdk/tools/emulator/bin"; 
+       m_emulator_manager_module = "emulator-manager.jar"; 
+       m_vmname = "testvm";
+
+       m_script_play_test = "/opt/home/root/codec_test_automation.sh";       
+       m_script_encdec_test = "/opt/home/root/codec_test_automation.sh";
+
+       m_report_dir = "..//report//";
+
+       m_report_file_prefix_summary = "report_summary";
+       m_report_file_prefix_details = "report_tc";
+}
+
+Env::~Env()
+{
 }
 
 //
@@ -224,25 +245,69 @@ void TC::Finish()
 //
 
 TCModel::TCModel()
-: m_succ_cnt(0), m_fail_cnt(0), m_tot_cnt(0)
-{}
+: m_succ_cnt(0), m_fail_cnt(0), m_tot_cnt(0), m_not_tested(0)
+{
+       Init();
+}
 
 TCModel::~TCModel()
 {
        Cleanup();
 }
 
-void TCModel::IncSucc()
+void TCModel::Start()
+{
+       Run();
+}
+
+void TCModel::Stop()
+{
+       if (m_report.valid())
+               m_report = tsnull;
+}
+
+void TCModel::OnStarted(TObj* tc)
+{
+
+}
+
+void TCModel::OnStopped(TObj* tc)
+{
+
+}
+
+void TCModel::Run()
+{
+       _S_FOR_NEXT(TCLIST, m_tclist, it)
+       {
+               smart_ptr<TC> tc = (*it);
+               if (!tc.valid())
+               {
+                       printf("[ERROR] : TCModel::Run\n");
+                       break;
+               }
+               OnStarted(tc);
+
+               tc->Test();
+
+               OnStopped(tc);
+       }
+}
+
+
+
+void TCModel::inc_succ_cnt()
 {
        m_succ_cnt++;
        m_tot_cnt++;
 }
 
-void TCModel::IncFail()
+void TCModel::inc_fail_cnt()
 {
        m_fail_cnt++;
        m_tot_cnt++;
 }
+
 void TCModel::SetEnv(const Env& env)
 {
        m_env = env;
@@ -251,17 +316,94 @@ void TCModel::SetEnv(const Env& env)
 void TCModel::Add(TC* tc)
 {
        m_tclist.insert(m_tclist.end(), tc);
+       //m_tot_cnt = m_tclist.size();
+}
+
+ReportMgr* TCModel::GetReportMgr()
+{
+       if (!m_report.valid())
+               return tsnull;
+       return const_cast<ReportMgr*>(m_report.get());
+}
+
+TCLIST& TCModel::GetTcList()
+{
+       return m_tclist;
+}
+
+void TCModel::Init()
+{
+       make_timestamp(m_timestr);
+
+       if (!m_report.attach(CreateReportMgr(this)).valid())
+       if (!m_report)
+       {
+               printf("[ERROR] : fail to create reprotmgr\n");
+               return;
+       }
+
+
+       printf("[INFO] : TCModel::Init\n");
 }
 
 void TCModel::Cleanup()
 {
+       Stop();
        m_tclist.clear();
 }
 
+
+
+//
+void SetEnv(Env* env)
+{
+       TCModel* mdl = GetTCModel();
+       mdl->SetEnv(*env);
+}
+
+void SetTCModel(TCModel* model)
+{
+       TCModel* mdl = GetTCModel();
+       mdl->SetEnv(model->m_env);
+       //g_tcmodel = model;
+}
+
+void AddTestSuite(TC* tc)
+{
+       TCModel* mdl = GetTCModel();
+       mdl->Add(tc);
+}
+
 TCModel* GetTCModel()
 {
-       static TCModel model;
-       return &model;
+       static TCModel stmodel;
+       return &stmodel;
+}
+
+void make_tc_names(const int tclevel, TObj* tc,  std::string& cat, std::string& subcat, std::string& tcname)
+{
+       if (tclevel == eTC_LEVEL_TESTSUITE)
+       {
+               cat = tc->GetName();
+               subcat = "-";
+               tcname = "-";
+       }
+       else if (tclevel == eTC_LEVEL_TESTCASE)
+       {
+               TObj* parent = tc->GetParent(); 
+               cat = (parent) ? parent->GetName() : tc->GetName();
+               subcat = tc->GetName();
+               tcname = tc->GetName();
+
+       }
+       else if (tclevel == eTC_LEVEL_METHOD)
+       {
+               TObj* parent = tc->GetParent();
+               TObj* grand = (parent) ? parent->GetParent() : NULL;
+               cat = (grand) ? grand->GetName() : "-";
+               subcat = (parent) ? parent->GetName() : "-";
+               tcname = tc->GetName();
+       }
 }
 
 } // end of namespace
index 9737361..e525af0 100644 (file)
@@ -7,11 +7,11 @@
 #include <string>
 #include <iostream>
 #include <algorithm>
-#include <stdarg.h>
 #include "sshell.h"
 #include "tcmacro.h"
 #include "obj.h"
 #include "base.h"
+#include "Report.h"
 
 
 namespace te_test {
@@ -27,7 +27,6 @@ enum
        eTC_LEVEL_MODULE = 3
 };
 
-
 class CommandResultHandler
 {
 public:
@@ -55,6 +54,10 @@ public:
        std::string m_successToken;
 };
 
+class TCModel;
+
+TCModel* GetTCModel();
+
 //
 // TObj class
 //
@@ -62,13 +65,8 @@ class TObj
        : public Ref
 {
 public:
-       TObj(const char* name)
-                : m_bOptional(false), m_parent(NULL), m_tclevel(eTC_LEVEL_TESTCASE), 
-                m_bResult(false), m_name(name), m_desc("-"), 
-                m_ChildSuccessCount(0), m_RepeatCount(1), m_CurrentPos(0)
-       {
-       }
-       virtual ~TObj(){}
+       TObj(const char* name);
+       virtual ~TObj();
 
        void SetName(const char name);
        void SetDesc(const char desc);
@@ -82,7 +80,6 @@ public:
        
        virtual void Prepare(){}
        virtual bool Test(){ return true; }
-       virtual void MakeResult(){}
        virtual void Finish(){}
 
        virtual void AddParam(std::string name){}                                                    
@@ -93,205 +90,35 @@ public:
        virtual bool IsSucceed() const;
        virtual void SetOptional(const bool bOptional);
        virtual bool IsOptional() const;
+
+
+       int GetSuccCnt() const { return m_succ_cnt; }
+       int GetFailCnt() const { return m_fail_cnt; }
+       int GetTotCnt() const { return m_tot_cnt; }
+       int GetNotTested() const { return m_not_tested; }
+
+       void write_report(const int tclevel, tscstr cat,tscstr subcat, tscstr tcname, bool issucc, tscstr cmd, tscstr output, tscstr etc);
        
 protected:
        int m_RepeatCount;
-       int m_CurrentPos;
-       int m_ChildSuccessCount;
+
+       int m_succ_cnt;
+       int m_fail_cnt;
+       int m_tot_cnt;
+       int m_not_tested;
+
+
        std::string m_name;
        std::string m_desc;
        int  m_tclevel; 
        bool m_bResult;
        TObj* m_parent;
        bool m_bOptional;
-};
 
-class TCModel;
-
-TCModel* GetTCModel();
-
-//
-// CommandTest class
-//
-template <class RESULT_PROC>
-class CommandTest : public TObj
-{
-public:
-       enum 
-       {
-               eCALLTYPE_NORMAL = 0, 
-               eCALLTYPE_WAIT = 1,
-               eCALLTYPE_REPEAT_WAIT = 2
-       };
-
-       CommandTest(const char* name) : 
-               TObj(name), m_calltype(eCALLTYPE_NORMAL), m_timeout_milli(0)
-       {
-               m_model = GetTCModel();
-       }
-
-       virtual bool Test();
-
-       void AddParam(std::string name)                      
-       {                                                    
-               if (!name.empty())                               
-               {                                                
-                       m_cmd.append(" ");                           
-                       m_cmd.append(name);                          
-               }                                                
-       }                                                    
-       void AddParam(std::string name, std::string value)   
-       {                                                    
-               if (!name.empty())                               
-               {                                                
-                       m_cmd.append(" ");                           
-                       m_cmd.append(name);                          
-               }                                                
-               if (!value.empty())                              
-               {                                                
-                       m_cmd.append(" ");                           
-                       m_cmd.append(value);                         
-               }                                                
-       }                                                    
-
-
-       void AddParamEX(std::string name)                      
-       {                                                    
-               if (!name.empty())                               
-               {                                                
-                       m_extparams.append(" ");                           
-                       m_extparams.append(name);                          
-               }                                                
-       }                                                    
-       void AddParamEX(std::string name, std::string value)   
-       {                                                    
-               if (!name.empty())                               
-               {                                                
-                       m_extparams.append(" ");                           
-                       m_extparams.append(name);                          
-               }                                                
-               if (!value.empty())                              
-               {                                                
-                       m_extparams.append(" ");                           
-                       m_extparams.append(value);                         
-               }                                                
-       }                                                    
-
-       bool SetCommand(const char* cmd);
-
-       void SetCallType(const int calltype)
-       {
-               m_calltype = calltype;
-       }       
-
-       void SetWaitStr(const char* str)
-       {
-               m_waitstr = str;
-       }
-
-protected:     
-       void FormatCommand(std::string& retval, const char* fmt, ...);  
-       bool Exec();    
-       virtual void MakeResult();      
-       std::string m_cmd;
-       std::string m_extparams;
-       std::string m_resultstr;
-       std::string m_waitstr;
-       RESULT_PROC m_resultProc;
        TCModel* m_model;
-
-       int m_timeout_milli;
-       int m_calltype;
 };
 
-bool FormatStr(const char* fmt, va_list varg, std::string& retval);
-
-template <class RESULT_PROC> 
-void CommandTest<RESULT_PROC>::FormatCommand(std::string& retval, const char* fmt, ...)
-{
-       va_list varg;
-       va_start(varg, fmt);
-       FormatStr(fmt, varg, retval);
-       va_end(varg);
-}
-
-template <class RESULT_PROC> 
-bool CommandTest<RESULT_PROC>::SetCommand(const char* cmd)
-{
-       if (!cmd)
-               return false;
-       m_cmd = cmd;
-       return true;
-}
-
-template <class RESULT_PROC> 
-void CommandTest<RESULT_PROC>::MakeResult()
-{
-       bool ret = m_resultProc.GetResult(m_resultstr);
-
-       m_bResult = (ret);
-}
-
-template <class RESULT_PROC> 
-bool CommandTest<RESULT_PROC>::Exec()
-{
-       if (m_cmd.empty())
-               return false;
-       
-       if (!m_extparams.empty())
-               m_cmd.append(m_extparams);
-
-       m_resultstr = "";
-
-       sshell scmd(m_cmd.c_str());
-       switch (m_calltype)
-       {
-       case eCALLTYPE_NORMAL:
-               {
-                       if (!scmd.exec())
-                               return false; 
-               }
-               break;
-       case eCALLTYPE_WAIT :
-               {
-                       if (!scmd.exec_and_wait_str(1000 * 60, m_waitstr.c_str()))
-                               return false;           
-               }
-               break;
-       case eCALLTYPE_REPEAT_WAIT :
-               {
-                       if (!scmd.repeat_exec_and_wait_str(1000 * 60, m_waitstr.c_str()))
-                               return false;   
-               }
-               break;
-       }
-
-       m_resultstr = scmd.result();
-       return true;
-}
-
-template <class RESULT_PROC> 
-bool CommandTest<RESULT_PROC>::Test() 
-{ 
-       Prepare();
-
-       if (!Exec())       
-               goto fail;  
-
-       MakeResult();
-
-       Finish();
-       return m_bResult;
-fail:
-       
-       m_bResult = false;
-       Finish();
-       return m_bResult;           
-} 
-
-//
 // TC class
-//
 
 class TC : public TObj
 {
@@ -304,12 +131,11 @@ public:
        TObj* Get(int idx);
        
        virtual bool Test();
-       virtual void MakeResult();
+       void _MakeResult();
        virtual void Finish();  
 
-       TCModel* m_model;
 private:
-       void ChildTest();
+       void RunChild();
 
        typedef std::vector< smart_ptr<TObj> > __TC_LIST;
        __TC_LIST m_tclist;
@@ -320,49 +146,72 @@ private:
 
 struct Env
 {
-       Env()
-       {
-               m_modulepath = "~/tizen-sdk/tools/emulator/bin"; 
-               m_emulator_manager_module = "emulator-manager.jar"; 
-               m_vmname = "testvm";
-
-               m_script_play_test = "/opt/home/root/codec_test_automation.sh";       
-               m_script_encdec_test = "/opt/home/root/codec_test_automation.sh";
-
-       }
+public:
+       Env();
+       virtual ~Env();
        std::string m_modulepath;
        std::string m_emulator_manager_module;
        std::string m_vmname;
 
        std::string m_script_play_test;
-       std::string m_script_encdec_test;     
+       std::string m_script_encdec_test;
+
+
+       std::string m_report_dir;
 
+       std::string m_report_file_prefix_summary;
+       std::string m_report_file_prefix_details;
 };
 
+typedef std::list< smart_ptr<TC> > TCLIST;
+
 class TCModel
 {
 public:
        TCModel();
        virtual ~TCModel();
 
-       void IncSucc();
-       void IncFail();
+       virtual void Start();
+       virtual void Stop();
+
+       void OnStarted(TObj* tc);
+       void OnStopped(TObj* tc);
+
        void SetEnv(const Env& env);
 
        void Add(TC* tc);
 
+       void inc_succ_cnt();
+       void inc_fail_cnt();
+
+       ReportMgr* GetReportMgr();
+
+       TCLIST& GetTcList();
+
        Env m_env;
+
+       std::string m_timestr;
 private:
+       void Init();
        void Cleanup();
-       typedef std::list< smart_ptr<TC> > TCLIST;
+       void Run();
+       
        TCLIST m_tclist;
 
+       smart_ptr<ReportMgr> m_report;
+public:
        int m_succ_cnt;
        int m_fail_cnt;
        int m_tot_cnt;
+       int m_not_tested;
 };
 
 
+void SetTCModel(TCModel* model);
+
+void SetEnv(Env* env);
+
+void AddTestSuite(TC* tc);
 
 void make_tc_names(const int tclevel, TObj* tc,  std::string& cat, std::string& subcat, std::string& tcname);
 
index 6e40308..a4401a1 100644 (file)
@@ -8,7 +8,7 @@ namespace te_test {
 
 // scmd
 
-scmd::scmd(const char* name) : CommandTest<CommandResultHandler>(name) 
+scmd::scmd(const char* name) : cmdtest<CommandResultHandler>(name) 
 {
        SetLevel(eTC_LEVEL_METHOD);
 }
@@ -33,19 +33,19 @@ void scmd::Finish()
        std::string cat, subcat, tcname;                    
        make_tc_names(m_tclevel, this, cat, subcat, tcname);
 
-       ReportMgr* report = GetReportMgr();
-       if (report)
-               report->Write(m_tclevel, cat.c_str(), subcat.c_str(), tcname.c_str(), 
-                                               m_bResult, m_cmd.c_str(), m_resultstr.c_str(), "...");
-
+       write_report(m_tclevel, cat.c_str(), subcat.c_str(), tcname.c_str(), m_bResult, m_cmd.c_str(), m_resultstr.c_str(), "...");
 }
 
 // java
 sjava::sjava(const char* name) : scmd(name)
 { 
        char buf[1024]; 
-       sprintf(buf, "java -jar %s/%s", m_model->m_env.m_modulepath.c_str(), m_model->m_env.m_emulator_manager_module.c_str()); 
-
+#ifdef WIN32
+       sprintf(buf, "java -jar %s\\%s", m_model->m_env.m_modulepath.c_str(), m_model->m_env.m_emulator_manager_module.c_str()); 
+#else
+       sprintf(buf, "java -jar %s/%s", m_model->m_env.m_modulepath.c_str(), m_model->m_env.m_emulator_manager_module.c_str());
+#endif
+       //printf("%s\n", buf);
        m_cmd = buf; 
 }                                                                                            
 
@@ -59,7 +59,7 @@ ssdb::ssdb(const char* name) : scmd(name)
 } 
 
 //
-// cmd suite which is collection of command
+// cmd suite which is collection of commands
 //
 
 cmd_suite::cmd_suite(const char* name) : TC(name) 
@@ -67,13 +67,6 @@ cmd_suite::cmd_suite(const char* name) : TC(name)
        SetLevel(eTC_LEVEL_TESTSUITE);
 }
 
-void cmd_suite::runTest()
-{
-       Prepare();
-       Test();
-       Finish();
-}
-
 void cmd_suite::AddCmdTest(scmd* tc)
 {
        Add(tc);
index 73aa00a..ccb2002 100644 (file)
@@ -3,11 +3,12 @@
 
 #include "tcbase.h"
 #include "tinythread.h"
+#include "cmdtest.h"
 
 namespace te_test {
 
 
-class scmd : public CommandTest<CommandResultHandler> 
+class scmd : public cmdtest<CommandResultHandler> 
 {
 public:
        scmd(const char* name);
@@ -17,20 +18,20 @@ public:
 
        void AddParam1(std::string name)                      
        {                                                    
-               CommandTest<CommandResultHandler>::AddParam(name);
+               cmdtest<CommandResultHandler>::AddParam(name);
        }                                                    
        void AddParam2(std::string name, std::string value)   
        {                                                    
-               CommandTest<CommandResultHandler>::AddParam(name, value);
+               cmdtest<CommandResultHandler>::AddParam(name, value);
        }                                                    
 
        void AddParamEX1(std::string name)                      
        {                                                    
-               CommandTest<CommandResultHandler>::AddParamEX(name);
+               cmdtest<CommandResultHandler>::AddParamEX(name);
        }                                                    
        void AddParamEX2(std::string name, std::string value)   
        {                                                    
-               CommandTest<CommandResultHandler>::AddParamEX(name, value);
+               cmdtest<CommandResultHandler>::AddParamEX(name, value);
        }                                                    
 };
 
@@ -55,8 +56,6 @@ class cmd_suite : public TC
 public:
        cmd_suite(const char* name); 
 
-       void runTest();
-
        void AddCmdTest(scmd* tc);
        void AddCmdTestStr(std::string cmd);
        void AddSDBCommandStr(std::string param);
index 6fecfab..ef81cd3 100644 (file)
@@ -144,13 +144,7 @@ void stcpnet::Finish()
     std::string cat, subcat, tcname;                                                    
     make_tc_names(m_tclevel, this, cat, subcat, tcname);                                
 
-    ReportMgr* report = GetReportMgr();                                                 
-    if (!report)
-        return;
-   
-    report->Write(m_tclevel, cat.c_str(), subcat.c_str(), tcname.c_str(), m_bResult, m_request_log.c_str(), m_result_log.c_str(), "...");
-
-
+       write_report(m_tclevel, cat.c_str(), subcat.c_str(), tcname.c_str(), m_bResult, m_request_log.c_str(), m_result_log.c_str(), "...");
 }
 
 void stcpnet::add_request_log(const char* str)          
index 1b1c4a4..bf1b4ab 100644 (file)
@@ -1,5 +1,6 @@
 #include "util.h"
 #include <time.h>
+#include <stdio.h>
 
 #ifdef WIN32
        #include <windows.h>
@@ -8,6 +9,19 @@
 #endif
 
 
+bool format_str(const char* fmt, va_list varg, std::string& retval)
+{
+       retval = "";
+       char buf[1024];
+       int ret = vsnprintf(buf, 1024, fmt, varg);
+       if (ret == -1)
+               return false;
+       buf[ret] = 0;
+
+       retval = ret;
+       return true;
+}
+
 void replacetext(std::string& str, const char* szsrc, const char* szdest)
 {
     std::string strsrc(szsrc);
@@ -30,31 +44,12 @@ void make_timestamp(std::string& ret)
        ts = localtime(&ltime);
        
        char buf[512];
+       //strftime(buf, sizeof(buf), "%a %Y-%m-%d %H:%M:%S %Z", ts);
+       strftime(buf, sizeof(buf), "%a_%Y-%m-%d_%H-%M-%S", ts);
 
-       strftime(buf, sizeof(buf), "%a %Y-%m-%d %H:%M:%S %Z", ts);
-
-       /*sprintf(buf, "[%d] %d %d %d_%d:%d:%d",
-        ts->tm_wday, /* Mon - Sun 
-        ts->tm_mday,
-        ts->tm_mon+1,
-        ts->tm_year+1900,
-        ts->tm_hour,
-        ts->tm_min,
-        ts->tm_sec);*/
-
-       //sprintf(buf, "%s", asctime(localtime(&ltime)));
        ret = buf;
 }
 
-//void util_sleep(int milisec)
-//{
-//     struct timespec req = { 0 };
-//     struct timespec rem = { 0 };
-//     req.tv_sec = (milisec / 1000);
-//     req.tv_nsec = (milisec - req.tv_sec * 1000) * 1000000;
-//     nanosleep(&req,&rem);
-//}
-
 void ssleep(int seconds)
 {
 #ifdef WIN32
index 63cbef1..271b7c4 100644 (file)
@@ -4,8 +4,9 @@
 #include <string>
 #include <sys/time.h>
 #include <algorithm>
+#include <stdarg.h>
 
-
+bool format_str(const char* fmt, va_list varg, std::string& retval);
 void replacetext(std::string& str, const char* szsrc, const char* szdest);
 void make_timestamp(std::string& ret);
 void ssleep(int seconds);