Permalink
Browse files

Read in atlas.xml in out of tree builds.

  • Loading branch information...
1 parent cf86c5a commit 0723611a0dee5b7d9f6d6f0edd870343342e28ae @erikogenvik erikogenvik committed Oct 7, 2011
Showing with 37 additions and 6 deletions.
  1. +10 −2 tests/Objects/decoder1.cpp
  2. +10 −2 tests/Objects/encoder1.cpp
  3. +17 −2 tests/Objects/objects2.cpp
View
@@ -2,6 +2,7 @@
#include <Atlas/Objects/loadDefaults.h>
#include <iostream>
+#include <cstdlib>
bool root_arrived = false;
bool look_arrived = false;
@@ -40,10 +41,17 @@ class TestDecoder : public Atlas::Objects::Dispatcher
int main(int argc, char** argv)
{
+ std::string atlas_xml_path;
+ char * srcdir_env = getenv("srcdir");
+ if (srcdir_env != 0) {
+ atlas_xml_path = srcdir_env;
+ atlas_xml_path += "/";
+ }
+ atlas_xml_path += "../../protocol/spec/atlas.xml";
try {
- Atlas::Objects::loadDefaults("../../../../protocols/atlas/spec/atlas.xml");
+ Atlas::Objects::loadDefaults(atlas_xml_path);
} catch(Atlas::Objects::DefaultLoadingException e) {
- std::cout << "DefaultLoadingException: "
+ std::cout << "DefaultLoadingException: "
<< e.getDescription() << std::endl;
}
TestDecoder t;
View
@@ -6,6 +6,7 @@
#include <string>
#include <iostream>
+#include <cstdlib>
class RootDecoder : public Atlas::Message::DecoderBase
{
@@ -21,10 +22,17 @@ class RootDecoder : public Atlas::Message::DecoderBase
int main(int argc, char** argv)
{
+ std::string atlas_xml_path;
+ char * srcdir_env = getenv("srcdir");
+ if (srcdir_env != 0) {
+ atlas_xml_path = srcdir_env;
+ atlas_xml_path += "/";
+ }
+ atlas_xml_path += "../../protocol/spec/atlas.xml";
try {
- Atlas::Objects::loadDefaults("../../../../protocols/atlas/spec/atlas.xml");
+ Atlas::Objects::loadDefaults(atlas_xml_path);
} catch(Atlas::Objects::DefaultLoadingException e) {
- std::cout << "DefaultLoadingException: "
+ std::cout << "DefaultLoadingException: "
<< e.getDescription() << std::endl;
}
RootDecoder rd;
View
@@ -20,6 +20,7 @@
#include <sstream>
#include <cassert>
#include <vector>
+#include <cstdlib>
#if USE_XML
#define USE_FILE 0
@@ -118,7 +119,14 @@ void testXML()
TestDecoder bridge;
#if USE_FILE
fstream stream;
- stream.open("../../../../protocols/atlas/spec/atlas.xml", std::ios::in);
+ std::string atlas_xml_path;
+ char * srcdir_env = getenv("srcdir");
+ if (srcdir_env != 0) {
+ atlas_xml_path = srcdir_env;
+ atlas_xml_path += "/";
+ }
+ atlas_xml_path += "../../protocol/spec/atlas.xml";
+ stream.open(atlas_xml_path, std::ios::in);
assert(!!stream);
#else
std::stringstream stream;
@@ -429,8 +437,15 @@ void test()
int main()
{
+ std::string atlas_xml_path;
+ char * srcdir_env = getenv("srcdir");
+ if (srcdir_env != 0) {
+ atlas_xml_path = srcdir_env;
+ atlas_xml_path += "/";
+ }
+ atlas_xml_path += "../../protocol/spec/atlas.xml";
try {
- Atlas::Objects::loadDefaults("../../../../protocols/atlas/spec/atlas.xml");
+ Atlas::Objects::loadDefaults(atlas_xml_path);
} catch(Atlas::Objects::DefaultLoadingException e) {
std::cout << "DefaultLoadingException: "
<< e.getDescription() << std::endl;

0 comments on commit 0723611

Please sign in to comment.