User forums > Help

C::B 13.12 Can't work with big project which have more than 100 files.

<< < (9/10) > >>

ollydbg:

--- Quote from: ollydbg on March 02, 2014, 01:10:59 am ---
BTW, current trunk build failed:

--- Code: ----------------- Build: Code-completion in Code::Blocks wx2.8.x (compiler: GNU GCC Compiler)---------------

[  5.0%] g++.exe -Wall -g -pipe -mthreads -fmessage-length=0 -fexceptions -Winvalid-pch -DHAVE_W32API_H -D__WXMSW__ -DWXUSINGDLL -DcbDEBUG -DCB_PRECOMP -DWX_PRECOMP -DwxUSE_UNICODE -DBUILDING_PLUGIN -iquote.objs\include -I.objs\include -I. -IE:\code\wx-mingw-build-481-dw2\wxWidgets-2.8.12\include -IE:\code\wx-mingw-build-481-dw2\wxWidgets-2.8.12\lib\gcc_dll\mswu -Isdk\wxscintilla\include -Isdk\wxpropgrid\include -Iinclude\tinyxml -Iinclude -Iinclude\mozilla_chardet -Iinclude\mozilla_chardet\mfbt -Iinclude\mozilla_chardet\nsprpub\pr\include -Iinclude\mozilla_chardet\xpcom -Iinclude\mozilla_chardet\xpcom\base -Iinclude\mozilla_chardet\xpcom\glue -c plugins\codecompletion\ccoptionsdlg.cpp -o .objs\plugins\codecompletion\ccoptionsdlg.o
plugins\codecompletion\ccoptionsdlg.cpp: In constructor 'CCOptionsDlg::CCOptionsDlg(wxWindow*, NativeParser*, CodeCompletion*, DocumentationHelper*)':
plugins\codecompletion\ccoptionsdlg.cpp:180:84: error: 'class DocumentationHelper' has no member named 'GetOptions'
plugins\codecompletion\ccoptionsdlg.cpp:181:84: error: 'class DocumentationHelper' has no member named 'GetOptions'
plugins\codecompletion\ccoptionsdlg.cpp: In member function 'virtual void CCOptionsDlg::OnApply()':
plugins\codecompletion\ccoptionsdlg.cpp:287:22: error: 'class DocumentationHelper' has no member named 'GetOptions'
plugins\codecompletion\ccoptionsdlg.cpp:288:22: error: 'class DocumentationHelper' has no member named 'GetOptions'
Process terminated with status 1 (0 minute(s), 55 second(s))
4 error(s), 0 warning(s) (0 minute(s), 55 second(s))

--- End code ---
Do you forget to commit the change of GetOptions?


--- End quote ---
Fixed in trunk now.

ollydbg:

--- Quote from: MortenMacFly on March 01, 2014, 10:11:27 pm ---Well actually not. If you comment the line cctest does simply nothing. At least not on my pc...

--- End quote ---
That was strange, I just comment the line

--- Code: ---m_NativeParser.Parse(m_CurrentFile);

--- End code ---
But if you look at the code:

--- Code: ---bool NativeParserTest::TestParseAndCodeCompletion(wxString filename)
{
    Clear();//clear the tree
    bool parseResult = false;
    parseResult = Parse(filename);
    if(!parseResult)
        return false;
    int passCount = 0;
    int failCount = 0;

    wxString testResult;
    wxString message = wxString::Format(_T("********************************************************\n  Testing in file: %s\n********************************************************"),filename.wx_str());
    wxLogMessage(message);
    testResult<<message<<wxT("\n");


    // read the test cases of CodeCompletion test
    wxTextFile source;
    source.Open(filename);
    wxString str;

    for ( str = source.GetLastLine();
          source.GetCurrentLine() > 0;
          str = source.GetPrevLine() )
    {

        // a test case should be put in a line, and start with the double slash
        if (str.StartsWith(_T("//")))
        {
            // do tests here, example of line is below
            // tc.St    //StaticVoid
            // remove the beginning "//"
            str.Remove(0,2);

            // find the second "//", the string after the second double slash are the
            // the result should be listed
            wxString expression;
            wxString match;
            int pos = str.Find(_T("//"));
            if (pos == wxNOT_FOUND)
                break;
            expression = str.Mid(0,pos);
            match = str.Mid(pos+2);// the remaining string

            expression.Trim();
            expression.Trim(true);
            match.Trim();
            match.Trim(true);

            wxArrayString suggestList;
            // the match can have many items, like: AAA,BBBB
            wxStringTokenizer tkz(match, wxT(","));
            while ( tkz.HasMoreTokens() )
            {
                wxString token = tkz.GetNextToken();
                suggestList.Add(token);
            }

            TokenIdxSet searchScope;
            searchScope.insert(-1);
            TokenIdxSet result;
            TestExpression(expression,searchScope,result);

            // loop the suggestList to see it is in the result Tokens
            for (size_t i=0;i<suggestList.GetCount();i++)
            {
                wxString element = suggestList[i];
                bool pass = false; // pass the test?
                for (TokenIdxSet::const_iterator it = result.begin();
                     it != result.end();
                     ++it)
                {
                    const Token* token = m_Parser.GetTokenTree()->at(*it);
                    if (!token || token->m_Name.IsEmpty())
                        continue;
                    if (element.IsSameAs(token->m_Name))
                    {
                        message = wxString::Format(_T("-PASS: %s  %s"),expression.wx_str(),element.wx_str());
                        testResult<<message<<wxT("\n");
                        wxLogMessage(message);
                        pass = true;
                        passCount++;
                    }

                }
                if (pass == false)
                {
                    message = wxString::Format(_T("*FAIL: %s  %s"),expression.wx_str(),element.wx_str());
                    testResult<<message<<wxT("\n");
                    wxLogMessage(message);
                    failCount++;
                }
            }
            // wxLogMessage(_T("Result have %lu matches"), static_cast<unsigned long>(result.size()));
        }
        else
            break; // if the line is not started with //, then we just stop testing
    }

    // report the test result here again in the last stage, further more, we can show this in another text control

    wxLogMessage(wxT("--------------------------------------------------------\nTotal %d tests, %d PASS, %d FAIL\n--------------------------------------------------------"), passCount+failCount, passCount, failCount);

    return true;
}

--- End code ---

You see, the steps of NativeParserTest::TestParseAndCodeCompletion is:
1, clear the TokenTree
2, parse the file
3, run tests
4, report fail and pass results.

BTW: Here is the log message I see:

--- Code: ---000001. --------------M-a-i-n--L-o-g--------------


000002. -----------I-n-t-e-r-i-m--L-o-g-----------
********************************************************
  Testing in file: C:\DOCUME~1\zyh23\LOCALS~2\Temp\cc125.h
********************************************************
*FAIL:  vt[1].  GetInt
-PASS:  g_S.  i
-PASS:  g_  g_S
-PASS:  tc.Vo  Void
-PASS:  tc.St  StaticVoid
-PASS:  tc.GetC  GetClass
-PASS:  tc.GetI  GetInt
-PASS:  str.  size
-PASS:  str.  length
--------------------------------------------------------
Total 9 tests, 8 PASS, 1 FAIL
--------------------------------------------------------


--- End code ---

Note that I remove CC_PARSER_TEST macro definition in rev9644 (see the bold text below), since it run our test much faster, in the future, we can run many tests in a single run(we can have many cc_xxxxx files which contains many kinds of tests, then our cctest project test them one by one)


--- Quote ---SHA-1: 40c5a4c8323e26aad488c536d426d1ab34cc66a5

* * cctest: add a framework of codecompletion test, the details are listed in C::B forum topic (batch codecompletion test framework - http://forums.codeblocks.org/index.php/topic,17538.msg120196.html#msg120196)
1, remove the file cctest.h and cctest.cpp, because those standalone classes/functions were moved to NativeParserTest class (derived from NativeParserBase), so a lot of functions can be reused from NativeParserBase.
2, remove CC_PARSER_TEST definition to reduce parser log messages, only show codecompletion test result and the show fail and pass testing counts. If the user need to see the full parser log messages, they should define them, which will plot a log of log messages.
3, redirect the wxLogMessage to the text ctrl of the frame.
4, fix typo in comments, and add some comments.
5, project target setting change, make it a gui app instead of console app, and redirect the wxLogMessage to the wxTextCtrl.
6, set the default parsing file to testing/cc_function_decls.cpp, not the default test.h
7, add the wxsmith file to cbp, so it can be opened quickly from the project manager.
8, by default, Token tree structure is not logged, but it can be logged by click the "Print Tree" button.
9, add some string variable to the wx and gcc search path, avoid the hard-coded path.

git-svn-id: https://svn.code.sf.net/p/codeblocks/code/trunk@9644 2a5c6006-c6dd-42ca-98ab-0921f2732cef

--- End quote ---

MortenMacFly:

--- Quote from: ollydbg on March 02, 2014, 03:33:37 pm ---BTW: Here is the log message I see:

--- Code: ---000001. --------------M-a-i-n--L-o-g--------------


000002. -----------I-n-t-e-r-i-m--L-o-g-----------
********************************************************
  Testing in file: C:\DOCUME~1\zyh23\LOCALS~2\Temp\cc125.h
********************************************************
*FAIL:  vt[1].  GetInt
-PASS:  g_S.  i
-PASS:  g_  g_S
-PASS:  tc.Vo  Void
-PASS:  tc.St  StaticVoid
-PASS:  tc.GetC  GetClass
-PASS:  tc.GetI  GetInt
-PASS:  str.  size
-PASS:  str.  length
--------------------------------------------------------
Total 9 tests, 8 PASS, 1 FAIL
--------------------------------------------------------

--- End code ---

--- End quote ---
Yes, the verbose part of how the parser works is missing there, too. But thats the part (at least) I am usually interested.

ollydbg:

--- Quote from: MortenMacFly on March 02, 2014, 03:45:04 pm ---
--- Quote from: ollydbg on March 02, 2014, 03:33:37 pm ---BTW: Here is the log message I see:

--- Code: ---000001. --------------M-a-i-n--L-o-g--------------


000002. -----------I-n-t-e-r-i-m--L-o-g-----------
********************************************************
  Testing in file: C:\DOCUME~1\zyh23\LOCALS~2\Temp\cc125.h
********************************************************
*FAIL:  vt[1].  GetInt
-PASS:  g_S.  i
-PASS:  g_  g_S
-PASS:  tc.Vo  Void
-PASS:  tc.St  StaticVoid
-PASS:  tc.GetC  GetClass
-PASS:  tc.GetI  GetInt
-PASS:  str.  size
-PASS:  str.  length
--------------------------------------------------------
Total 9 tests, 8 PASS, 1 FAIL
--------------------------------------------------------

--- End code ---

--- End quote ---
Yes, the verbose part of how the parser works is missing there, too. But thats the part (at least) I am usually interested.

--- End quote ---
You can simply add the CC_PARSER_TEST, then every verbose log messages are returned, but parsing a file (specially have many #include files) will takes for a long time.  ;)
Maybe, we can add an option?

MortenMacFly:
Well the default case for me is that I have a small code snippet to reproduce a certain error. Then it will be very fast and the information is essential to track down parser errors. So yes, please make it an option which imho should be enabled by default.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version