Run tests
OBS-URL: https://build.opensuse.org/package/show/games/0ad?expand=0&rev=4
This commit is contained in:
parent
68350b5546
commit
a89b05e2d4
75
0ad-cs7783.patch
Normal file
75
0ad-cs7783.patch
Normal file
@ -0,0 +1,75 @@
|
||||
Index: source/ps/DllLoader.cpp
|
||||
===================================================================
|
||||
--- source/ps/DllLoader.cpp (revision 7782)
|
||||
+++ source/ps/DllLoader.cpp (revision 7783)
|
||||
@@ -27,12 +27,8 @@
|
||||
void* const HANDLE_UNAVAILABLE = (void*)-1;
|
||||
|
||||
|
||||
-// TODO Use path_util instead, get the actual path to the ps_dbg exe and append
|
||||
-// the library name.
|
||||
-
|
||||
// note: on Linux, lib is prepended to the SO file name;
|
||||
-// if we don't have an explicit libdir then we don't use
|
||||
-// a path with '/' so the linker will look in DT_RUNPATH
|
||||
+// if we don't have an explicit libdir then the linker will look in DT_RUNPATH
|
||||
// (which we set to $ORIGIN) to find it in the executable's directory
|
||||
#if OS_UNIX
|
||||
#ifdef INSTALLED_LIBDIR
|
||||
@@ -47,9 +43,11 @@
|
||||
// but for debugging/performance we prefer to use the same version as the app.
|
||||
// note: on Windows, the extension is replaced with .dll by dlopen.
|
||||
#ifndef NDEBUG
|
||||
-static const char* suffix = "_dbg.so";
|
||||
+static const char* primarySuffix = "_dbg.so";
|
||||
+static const char* secondarySuffix = ".so";
|
||||
#else
|
||||
-static const char* suffix = ".so";
|
||||
+static const char* primarySuffix = ".so";
|
||||
+static const char* secondarySuffix = "_dbg.so";
|
||||
#endif
|
||||
|
||||
// (This class is currently only used by 'Collada' and 'AtlasUI' which follow
|
||||
@@ -80,23 +78,37 @@
|
||||
{
|
||||
TIMER(L"LoadDLL");
|
||||
|
||||
- CStr filename = CStr(prefix) + m_Name + suffix;
|
||||
-
|
||||
// we don't really care when relocations take place, but one of
|
||||
// {RTLD_NOW, RTLD_LAZY} must be passed. go with the former because
|
||||
// it is safer and matches the Windows load behavior.
|
||||
const int flags = RTLD_LOCAL|RTLD_NOW;
|
||||
|
||||
+ CStr filename = CStr(prefix) + m_Name + primarySuffix;
|
||||
m_Handle = dlopen(filename, flags);
|
||||
|
||||
+ char* primaryError = NULL;
|
||||
+
|
||||
// open failed (mostly likely SO not found)
|
||||
if (! m_Handle)
|
||||
{
|
||||
- const char* error = dlerror();
|
||||
- if (error)
|
||||
- LOG(CLogger::Error, L"", L"dlopen error: %hs", error);
|
||||
+ primaryError = dlerror();
|
||||
+ if (primaryError)
|
||||
+ primaryError = strdup(primaryError); // don't get overwritten by next dlopen
|
||||
+
|
||||
+ // Try to open the other debug/release version
|
||||
+ filename = CStr(prefix) + m_Name + secondarySuffix;
|
||||
+ m_Handle = dlopen(filename, flags);
|
||||
+ }
|
||||
+
|
||||
+ // open still failed; report the first error
|
||||
+ if (! m_Handle)
|
||||
+ {
|
||||
+ if (primaryError)
|
||||
+ LOGERROR(L"dlopen error: %hs", primaryError);
|
||||
m_Handle = HANDLE_UNAVAILABLE;
|
||||
}
|
||||
+
|
||||
+ free(primaryError);
|
||||
}
|
||||
|
||||
return (m_Handle != HANDLE_UNAVAILABLE);
|
31
0ad-cs7793.patch
Normal file
31
0ad-cs7793.patch
Normal file
@ -0,0 +1,31 @@
|
||||
Index: source/tools/atlas/GameInterface/GameLoop.cpp
|
||||
===================================================================
|
||||
--- source/tools/atlas/GameInterface/GameLoop.cpp (revision 7792)
|
||||
+++ source/tools/atlas/GameInterface/GameLoop.cpp (revision 7793)
|
||||
@@ -1,4 +1,4 @@
|
||||
-/* Copyright (C) 2009 Wildfire Games.
|
||||
+/* Copyright (C) 2010 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@@ -63,8 +63,7 @@
|
||||
}
|
||||
|
||||
|
||||
-static MessagePasserImpl msgPasser;
|
||||
-MessagePasser* AtlasMessage::g_MessagePasser = &msgPasser;
|
||||
+MessagePasser* AtlasMessage::g_MessagePasser = NULL;
|
||||
|
||||
|
||||
static InputProcessor g_Input;
|
||||
@@ -118,6 +117,10 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
+ // Construct a message passer for communicating with Atlas
|
||||
+ MessagePasserImpl msgPasser;
|
||||
+ AtlasMessage::g_MessagePasser = &msgPasser;
|
||||
+
|
||||
// Pass our message handler to Atlas
|
||||
Atlas_SetMessagePasser(&msgPasser);
|
||||
|
129
0ad-cs7795.patch
Normal file
129
0ad-cs7795.patch
Normal file
@ -0,0 +1,129 @@
|
||||
Index: source/ps/DllLoader.h
|
||||
===================================================================
|
||||
--- source/ps/DllLoader.h (revision 7794)
|
||||
+++ source/ps/DllLoader.h (revision 7795)
|
||||
@@ -68,6 +68,11 @@
|
||||
template <typename T>
|
||||
void LoadSymbol(const char* name, T& fptr) const;
|
||||
|
||||
+ /**
|
||||
+ * Override the build-time setting of the directory to search for libraries.
|
||||
+ */
|
||||
+ static void OverrideLibdir(const CStr& libdir);
|
||||
+
|
||||
private:
|
||||
// Typeless version - the public LoadSymbol hides the slightly ugly
|
||||
// casting from users.
|
||||
Index: source/ps/DllLoader.cpp
|
||||
===================================================================
|
||||
--- source/ps/DllLoader.cpp (revision 7794)
|
||||
+++ source/ps/DllLoader.cpp (revision 7795)
|
||||
@@ -1,4 +1,4 @@
|
||||
-/* Copyright (C) 2009 Wildfire Games.
|
||||
+/* Copyright (C) 2010 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@@ -23,19 +23,23 @@
|
||||
#include "lib/posix/posix_dlfcn.h"
|
||||
#include "ps/CStr.h"
|
||||
#include "ps/CLogger.h"
|
||||
+#include "ps/GameSetup/Config.h"
|
||||
|
||||
void* const HANDLE_UNAVAILABLE = (void*)-1;
|
||||
|
||||
-
|
||||
-// note: on Linux, lib is prepended to the SO file name;
|
||||
+// directory to search for libraries (optionally set by --libdir at build-time,
|
||||
+// optionally overridden by -libdir at run-time in the test executable);
|
||||
// if we don't have an explicit libdir then the linker will look in DT_RUNPATH
|
||||
// (which we set to $ORIGIN) to find it in the executable's directory
|
||||
+#ifdef INSTALLED_LIBDIR
|
||||
+static CStr g_Libdir = STRINGIZE(INSTALLED_LIBDIR);
|
||||
+#else
|
||||
+static CStr g_Libdir = "";
|
||||
+#endif
|
||||
+
|
||||
+// note: on Linux, lib is prepended to the SO file name
|
||||
#if OS_UNIX
|
||||
- #ifdef INSTALLED_LIBDIR
|
||||
- static const char* prefix = STRINGIZE(INSTALLED_LIBDIR) "/lib";
|
||||
- #else
|
||||
- static const char* prefix = "lib";
|
||||
- #endif
|
||||
+static const char* prefix = "lib";
|
||||
#else
|
||||
static const char* prefix = "";
|
||||
#endif
|
||||
@@ -54,6 +58,15 @@
|
||||
// the naming/location convention above - it'll need to be changed if we want
|
||||
// to support other DLLs.)
|
||||
|
||||
+static CStr GenerateFilename(const CStr& name, const CStr& suffix)
|
||||
+{
|
||||
+ CStr n;
|
||||
+ if (!g_Libdir.empty())
|
||||
+ n = g_Libdir + "/";
|
||||
+ n += prefix + name + suffix;
|
||||
+ return n;
|
||||
+}
|
||||
+
|
||||
DllLoader::DllLoader(const char* name)
|
||||
: m_Name(name), m_Handle(0)
|
||||
{
|
||||
@@ -83,7 +96,7 @@
|
||||
// it is safer and matches the Windows load behavior.
|
||||
const int flags = RTLD_LOCAL|RTLD_NOW;
|
||||
|
||||
- CStr filename = CStr(prefix) + m_Name + primarySuffix;
|
||||
+ CStr filename = GenerateFilename(m_Name, primarySuffix);
|
||||
m_Handle = dlopen(filename, flags);
|
||||
|
||||
char* primaryError = NULL;
|
||||
@@ -96,7 +109,7 @@
|
||||
primaryError = strdup(primaryError); // don't get overwritten by next dlopen
|
||||
|
||||
// Try to open the other debug/release version
|
||||
- filename = CStr(prefix) + m_Name + secondarySuffix;
|
||||
+ filename = GenerateFilename(m_Name, secondarySuffix);
|
||||
m_Handle = dlopen(filename, flags);
|
||||
}
|
||||
|
||||
@@ -137,3 +150,8 @@
|
||||
if (*fptr == NULL)
|
||||
throw PSERROR_DllLoader_SymbolNotFound();
|
||||
}
|
||||
+
|
||||
+void DllLoader::OverrideLibdir(const CStr& libdir)
|
||||
+{
|
||||
+ g_Libdir = libdir;
|
||||
+}
|
||||
Index: libraries/cxxtest/include/cxxtest/PsTestWrapper.h
|
||||
===================================================================
|
||||
--- libraries/cxxtest/include/cxxtest/PsTestWrapper.h (revision 7794)
|
||||
+++ libraries/cxxtest/include/cxxtest/PsTestWrapper.h (revision 7795)
|
||||
@@ -16,6 +16,8 @@
|
||||
# define PS_TEST_WRAPPER_BASE GuiListener
|
||||
#endif
|
||||
|
||||
+#include "ps/DllLoader.h"
|
||||
+
|
||||
namespace CxxTest
|
||||
{
|
||||
extern const char *g_PsArgv0;
|
||||
@@ -112,12 +114,15 @@
|
||||
}
|
||||
} else if ( !strcmp( argv[i], "-list" ) ) {
|
||||
g_PsListSuites = true;
|
||||
+ } else if ( !strcmp( argv[i], "-libdir" ) ) {
|
||||
+ DllLoader::OverrideLibdir( argv[++i] );
|
||||
} else {
|
||||
fprintf( stderr, "Unrecognized command line option '%s'\n", argv[i] );
|
||||
fprintf( stderr, "Permitted options:\n" );
|
||||
fprintf( stderr, " %s -list\n", argv[0] );
|
||||
fprintf( stderr, " %s -test TestSuiteName\n", argv[0] );
|
||||
fprintf( stderr, " %s -test TestSuiteName::test_case_name\n", argv[0] );
|
||||
+ fprintf( stderr, " %s -libdir .\n", argv[0] );
|
||||
fprintf( stderr, "\n" );
|
||||
}
|
||||
}
|
10
0ad.spec
10
0ad.spec
@ -11,7 +11,10 @@ Patch0: 0ad-cs7755.patch
|
||||
Patch1: 0ad-cs7757.patch
|
||||
Patch2: 0ad-cs7758.patch
|
||||
Patch3: 0ad-cs7759.patch
|
||||
Patch4: 0ad-cs7791.patch
|
||||
Patch4: 0ad-cs7783.patch
|
||||
Patch5: 0ad-cs7791.patch
|
||||
Patch6: 0ad-cs7793.patch
|
||||
Patch7: 0ad-cs7795.patch
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
BuildRequires: binutils-devel
|
||||
BuildRequires: boost-devel
|
||||
@ -95,6 +98,9 @@ history.
|
||||
%patch2
|
||||
%patch3
|
||||
%patch4
|
||||
%patch5
|
||||
%patch6
|
||||
%patch7
|
||||
|
||||
%build
|
||||
export CFLAGS="%{optflags}"
|
||||
@ -107,7 +113,7 @@ popd
|
||||
|
||||
%check
|
||||
#__make check
|
||||
#binaries/system/test_dbg
|
||||
LD_LIBRARY_PATH=binaries/system binaries/system/test_dbg -libdir binaries/system
|
||||
|
||||
%install
|
||||
#makeinstall
|
||||
|
@ -35,6 +35,9 @@ build-stamp: config-stamp
|
||||
# $(MAKE) -j$(NUMJOBS) -C build/workspaces/gcc
|
||||
$(MAKE) -j2 -C build/workspaces/gcc
|
||||
|
||||
# Run tests
|
||||
LD_LIBRARY_PATH=binaries/system binaries/system/test_dbg -libdir binaries/system
|
||||
|
||||
touch $@
|
||||
|
||||
clean:
|
||||
|
@ -2,4 +2,7 @@
|
||||
0ad-cs7757.patch -p0
|
||||
0ad-cs7758.patch -p0
|
||||
0ad-cs7759.patch -p0
|
||||
0ad-cs7783.patch -p0
|
||||
0ad-cs7791.patch -p0
|
||||
0ad-cs7793.patch -p0
|
||||
0ad-cs7795.patch -p0
|
||||
|
Loading…
Reference in New Issue
Block a user