1
0
forked from 0ad/0ad

# Fixed unit test build system on Linux

This was SVN commit r4441.
This commit is contained in:
Ykkrosh 2006-09-30 21:09:02 +00:00
parent 920cbe4dc3
commit d0dd86d0b4
9 changed files with 67 additions and 25 deletions

View File

@ -609,11 +609,14 @@ function get_all_test_files(root, src_files, hdr_files)
for i,v in all_files do
-- header file in subdirectory test
if string.sub(v, -2) == ".h" and string.find(v, "/tests/") then
tinsert(hdr_files, v)
-- add the corresponding source file immediately, instead of
-- waiting for it to appear after cxxtestgen. this avoids
-- having to recreate workspace 2x after adding a test.
tinsert(src_files, string.sub(v, 1, -3) .. ".cpp")
-- don't include sysdep tests on the wrong sys
if not (string.find(v, "/sysdep/win/") and OS ~= "windows") then
tinsert(hdr_files, v)
-- add the corresponding source file immediately, instead of
-- waiting for it to appear after cxxtestgen. this avoids
-- having to recreate workspace 2x after adding a test.
tinsert(src_files, string.sub(v, 1, -3) .. ".cpp")
end
end
end
@ -635,8 +638,10 @@ function setup_tests()
package.pchheader = "precompiled.h"
package.rootoptions = "--gui=Win32Gui --runner=ParenPrinter --include="..package.pchheader
package.testoptions = "--include="..package.pchheader
else
package.rootoptions = "--error-printer"
package.rootoptions = "--runner=ErrorPrinter --include=pch/test/precompiled.h"
package.testoptions = "--include=pch/test/precompiled.h"
end
@ -663,6 +668,27 @@ function setup_tests()
package.pchheader = "precompiled.h"
package.pchsource = "precompiled.cpp"
tinsert(package.files, { pch_dir.."precompiled.cpp", pch_dir.."precompiled.h" })
package.rootoptions = "--include=precompiled.h"
elseif OS == "linux" then
tinsert(package.links, {
"fam",
-- Utilities
"pthread", "rt",
-- Debugging
"bfd", "iberty"
})
-- For debug_resolve_symbol
package.config["Debug"].linkoptions = { "-rdynamic" }
package.config["Testing"].linkoptions = { "-rdynamic" }
tinsert(package.libpaths, "/usr/X11R6/lib")
package.rootoptions = "--include=precompiled.h"
end
tinsert(package.buildflags, "use-library-dep-inputs")

View File

@ -223,7 +223,9 @@ int gnu_cpp()
}
else
{
io_print("\t@true\n\n", prefix);
io_print("\t@%s --root", prj_get_cxxtestpath());
io_print(" %s ", prj_get_cxxtest_rootoptions());
io_print(" -o %s\n\n", prj_get_cxxtest_rootfile());
}
/*
@ -432,15 +434,20 @@ static const char* listCppTargets(const char* name)
}
else if (prj_is_kind("cxxtestgen"))
{
const char *cxxtestpath = prj_get_cxxtestpath(); // must be called before path_swapex because of shared buffer
const char *target_name=path_swapextension(name, ".h", ".cpp");
const char *cxxtestpath = strdup(prj_get_cxxtestpath());
const char *cxxtestoptions = strdup(prj_get_cxxtest_options());
const char *target_name = path_swapextension(name, ".h", ".cpp");
sprintf(g_buffer,
"%s: %s\n"
"%s: %s\n"
"%s"
"\t%s%s --part -o %s %s\n", target_name, name,
"\t%s%s --part %s -o %s %s\n",
target_name, name,
g_verbose?"":"\t@echo $(notdir $<)\n",
g_verbose?"":"@",
cxxtestpath, target_name, name);
g_verbose?"":"@", cxxtestpath, cxxtestoptions, target_name, name);
free(cxxtestpath);
free(cxxtestoptions);
return g_buffer;
}

View File

@ -259,6 +259,11 @@ const char* prj_get_cxxtest_rootoptions()
return my_cfg->cxxtest_rootoptions;
}
const char* prj_get_cxxtest_options()
{
return my_cfg->cxxtest_options;
}
const char* prj_get_cxxtest_rootfile()
{
return my_cfg->cxxtest_rootfile;

View File

@ -56,6 +56,7 @@ typedef struct tagPkgConfig
const char* pchSource;
const char* trimprefix;
FileConfig** fileconfigs;
const char* cxxtest_options;
const char* cxxtest_rootoptions;
const char* cxxtest_rootfile;
} PkgConfig;
@ -133,8 +134,9 @@ Package* prj_get_package_for();
const char* prj_get_path();
const char* prj_get_pch_header();
const char* prj_get_pch_source();
const char* prj_get_cxxtest_rootoptions();
const char* prj_get_cxxtest_rootfile();
const char* prj_get_cxxtest_options();
const char* prj_get_cxxtest_rootoptions();
const char* prj_get_cxxtest_rootfile();
const char* prj_get_pkgfilename(const char* extension);
const char* prj_get_pkgname();
const char* prj_get_pkgname_for();

View File

@ -352,8 +352,9 @@ static int export_pkgconfig(Package* package, int tbl)
config->pchHeader = export_value(tbl, obj, "pchheader");
config->pchSource = export_value(tbl, obj, "pchsource");
config->trimprefix = export_value(tbl, obj, "trimprefix");
config->cxxtest_rootoptions = export_value(tbl, obj, "rootoptions");
config->cxxtest_rootfile = export_value(tbl, obj, "rootfile");
config->cxxtest_options = export_value(tbl, obj, "testoptions");
config->cxxtest_rootoptions = export_value(tbl, obj, "rootoptions");
config->cxxtest_rootfile = export_value(tbl, obj, "rootfile");
/* Assign a default target, if none specified */
if (config->target == NULL)

View File

@ -803,21 +803,22 @@ void vs_list_files(const char* path, int stage)
}
else if (prj_is_kind("cxxtestgen") && endsWith(path, ".h"))
{
char *targetname=strdup(path_swapextension(path, ".h", ".cpp"));
char *targetname = strdup(path_swapextension(path, ".h", ".cpp"));
char *testoptions = strdup(prj_get_cxxtest_options());
tag_open("Tool");
tag_attr("Name=\"VCCustomBuildTool\"");
tag_attr("Description=\"Generating %s\"", targetname);
tag_attr("CommandLine=\"%s%s --part %s%s -o &quot;%s&quot; &quot;$(InputPath)&quot;\"",
tag_attr("CommandLine=\"%s%s --part %s -o &quot;%s&quot; &quot;$(InputPath)&quot;\"",
endsWith(prj_get_cxxtestpath(), ".pl")?"perl ":"",
path_translate(prj_get_cxxtestpath(), "windows"),
pchHeader ? "--include=" : "",
pchHeader ? pchHeader : "",
testoptions,
targetname);
tag_attr("Outputs=\"%s\"", targetname);
tag_close("Tool", 0);
free(targetname);
free(testoptions);
}
else /* (.asm doesn't need PCH) */
{

View File

@ -25,7 +25,7 @@ public:
#else
// sounds strange, but correct: on non-Windows, \\ didn't
// get recognized as separators and weren't converted.
TS_ASSERT_STR_EQUALS(P_path, "a\\b\\c"));
TS_ASSERT_STR_EQUALS(P_path, "a\\b\\c");
#endif
}

View File

@ -189,7 +189,7 @@ public:
TestMultithread()
: is_complete(false), num_active_threads(0),
list(), hash(),
mutex(0) {}
mutex() {}
void disabled_due_to_failure_on_p4_test_multithread()
{

View File

@ -1,7 +1,7 @@
#include "lib/self_test.h"
#include "ps/XML/XML.h"
#include "ps/XML/XMLwriter.h"
#include "ps/XML/XMLWriter.h"
class TestXmlWriter : public CxxTest::TestSuite
{
@ -54,4 +54,4 @@ public:
// For this test to be useful, it should actually test something.
}
};
};