git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[QGIT RFC] Unit tests for QGit

From
JHJan Hudec <bulb@ucw.cz>
Date
Aug 8, 2008, 21:13 UTC
Message-ID
<20080808211318.GA4396@efreet.light.src>
Hello Marco and others,

I've been thinking about some refactoring of QGit since some time. And to be sure I don't screw up things too hard in the process, I thought about adding a test suite infrastructure first (and add some test cases for each think just before refactoring it).

The problem is, that implementing unittests means I need to compile 2 separate binaries -- qgit itself and the test -- using most (but not all) of the same sources. I see two ways to do it, so I'd like to ask which you consider cleaner:

 1. Reorganize stuff so that a (static) library is created from all the
    sources except qgit.cpp and than qgit.cpp is linked to this library to
    create qgit and the tests are linked with it to provide the test runner.
    Pros:
     - The .pro files should remain reasonably simple.
     - The sources are only compiled once.
    Cons:
     - Need to split the src directory to two, so bigger moving stuff around.
 2. Put the list of sources into file included in the src.pro and include it
    in the tests.pro file too.
    Pros:
     - No libraries and stuff
     - Less moving stuff around.
    Cons:
     - The sources actually get compiled twice, once for the tests and once
       for the qgit binary.
     - Paths to the sources need to be manually adjusted after including into
       the .pro files, making the .pro files rather ugly.

There seems to be no solution requiring less changes to the projects, because qmake can only create one library or executable per directory and including files from other directory is not supported to well.

I've already done the later (have patch series ready), but I am now thinking that I should probably redo it the first way. What do you think. Does it make sense to do that?

-- 
						 Jan 'Bulb' Hudec <bulb@ucw.cz>
Next: Benjamin Sergeant
Message 1 of 17 in “[QGIT RFC] Unit tests for QGit”
  1. Jan HudecAug 8, 2008
  2. Benjamin SergeantAug 8, 2008
  3. Jan HudecAug 10, 2008
  4. Marco CostalbaAug 17, 2008
  5. Jan HudecAug 17, 2008
  6. Marco CostalbaAug 17, 2008
  7. Jan HudecAug 17, 2008
  8. Marco CostalbaAug 17, 2008
  9. Jan HudecAug 18, 2008
  10. Marco CostalbaAug 19, 2008
  11. Jan HudecAug 27, 2008
  12. Marco CostalbaAug 28, 2008
  13. Karl HasselströmAug 28, 2008
  14. Marco CostalbaAug 28, 2008
  15. Jan HudecAug 28, 2008
  16. Marco CostalbaAug 29, 2008
  17. Karl HasselströmAug 28, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.