Final try at bug 351968 -- make relative topsrcdirs work, fixing the last build errors. Because xpcshell tests are fragile, this commit intentionally breaks a test so that I can verify correctness; I'll remove the break when I verify the fix works correctly (via broken test error messages).

This commit is contained in:
jwalden%mit.edu 2007-01-31 07:22:12 +00:00
Родитель d39b60b980
Коммит b47df8a726
7 изменённых файлов: 23 добавлений и 26 удалений

Просмотреть файл

@ -1820,17 +1820,10 @@ libs::
$(DEPTH)/_tests/xpcshell-simple/$(MODULE)/$$testdir; \
done
# topsrcdir can be relative, but since we need NATIVE_TOPSRCDIR to
# be absolute (it's passed to tests for use in getting access to
# files), we need to convert it.
#
# XXX is this the right way to do it?
_ABS_TOPSRCDIR := `realpath $(topsrcdir)`
ifdef CYGWIN_WRAPPER
NATIVE_TOPSRCDIR := `cygpath -wa $(_ABS_TOPSRCDIR)`
NATIVE_TOPSRCDIR := `cygpath -wa $(topsrcdir)`
else
NATIVE_TOPSRCDIR := $(_ABS_TOPSRCDIR)
NATIVE_TOPSRCDIR := $(topsrcdir)
endif # CYGWIN_WRAPPER
# Test execution

Просмотреть файл

@ -66,9 +66,7 @@ var __testsDirectory = null;
function ParseFile(file) {
if (typeof(file) == "string") {
if (!__testsDirectory) {
__testsDirectory = C["@mozilla.org/file/local;1"]
.createInstance(I.nsILocalFile);
__testsDirectory.initWithPath(do_get_topsrcdir());
__testsDirectory = do_get_topsrcdir();
__testsDirectory.append("content");
__testsDirectory.append("test");
__testsDirectory.append("unit");

Просмотреть файл

@ -31,9 +31,7 @@ function run_test()
"nsIConverterInputStream",
"init");
dataDir = Cc["@mozilla.org/file/local;1"]
.getService(Ci.nsILocalFile);
dataDir.initWithPath(do_get_topsrcdir());
dataDir = do_get_topsrcdir();
dataDir.append("intl");
dataDir.append("uconv");
dataDir.append("tests");

Просмотреть файл

@ -44,9 +44,7 @@ function run_test() {
const Ci = Components.interfaces;
// the build script have created the zip we can test on in the current dir.
var file = Cc["@mozilla.org/file/local;1"]
.createInstance(Ci.nsILocalFile);
file.initWithPath(do_get_topsrcdir());
var file = do_get_topsrcdir();
file.append("modules");
file.append("libjar");
file.append("test");

Просмотреть файл

@ -286,10 +286,11 @@ var testsDirectory;
function run_test()
{
testsDirectory = Cc["@mozilla.org/file/local;1"]
.createInstance(Ci.nsILocalFile);
dumpn("*** topsrcdir: " + do_get_topsrcdir());
testsDirectory.initWithPath(do_get_topsrcdir());
testsDirectory = do_get_topsrcdir();
dumpn("*** topsrcdir: " + testsDirectory.path);
dumpn("*** normalized: " + (v=testsDirectory.clone(),v.normalize(),v.path));
do_throw("xpcshell tests don't timeout -- doing this to verify fix, " +
"then will remove after verifying");
testsDirectory.append("netwerk");
testsDirectory.append("test");
testsDirectory.append("httpserver");

Просмотреть файл

@ -104,9 +104,7 @@ var srv, serverBasePath;
function run_test()
{
srv = createServer();
serverBasePath = Cc["@mozilla.org/file/local;1"]
.createInstance(Ci.nsILocalFile);
serverBasePath.initWithPath(do_get_topsrcdir());
serverBasePath = do_get_topsrcdir();
serverBasePath.append("netwerk");
serverBasePath.append("test");
serverBasePath.append("httpserver");

Просмотреть файл

@ -142,5 +142,16 @@ function do_import_script(topsrcdirRelativePath) {
}
function do_get_topsrcdir() {
return environment["NATIVE_TOPSRCDIR"];
try {
var lf = Components.classes["@mozilla.org/file/local;1"]
.createInstance(Components.interfaces.nsILocalFile);
lf.initWithPath(environment["NATIVE_TOPSRCDIR"]);
} catch (e) {
// relative topsrcdir
lf = Components.classes["@mozilla.org/file/directory_service;1"]
.getService(Components.interfaces.nsIProperties)
.get("CurWorkD", Ci.nsILocalFile);
lf.appendRelativePath(environment["NATIVE_TOPSRCDIR"]);
}
return lf;
}