Skip to content

Commit

Permalink
Fix some distribution problems.
Browse files Browse the repository at this point in the history
  • Loading branch information
FooBarWidget committed Mar 17, 2009
1 parent 4e57c4f commit 202d8d8
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Rakefile
Expand Up @@ -432,7 +432,7 @@ Rake::RDocTask.new(:clobber_rdoc => "rdoc:clobber", :rerdoc => "rdoc:force") do
rd.rdoc_files.include("README", "DEVELOPERS.TXT",
"lib/phusion_passenger/*.rb",
"lib/phusion_passenger/*/*.rb",
"lib/rake/extensions.rb",
"misc/rake/extensions.rb",
"ext/phusion_passenger/*.c")
rd.template = "./doc/template/horo"
rd.title = "Passenger Ruby API"
Expand Down
16 changes: 12 additions & 4 deletions test/UtilsTest.cpp
@@ -1,5 +1,6 @@
#include "tut.h"
#include "Utils.h"
#include "support/Support.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
Expand All @@ -9,6 +10,7 @@

using namespace Passenger;
using namespace std;
using namespace Test;

namespace tut {
struct UtilsTest {
Expand Down Expand Up @@ -254,9 +256,15 @@ namespace tut {
/***** Test resolveSymlink() *****/

TEST_METHOD(27) {
ensure_equals(resolveSymlink("stub/symlinks/file"), "stub/symlinks/foo.txt");
ensure_equals(resolveSymlink("stub/symlinks/file2"), "stub/symlinks/file");
ensure_equals(resolveSymlink("stub/symlinks/file3"), "stub/symlinks/file2");
ensure_equals(resolveSymlink("stub/symlinks/absolute_symlink"), "/foo/bar");
TempDir d("tmp.symlinks");
system("touch tmp.symlinks/foo.txt");
system("ln -s /usr/bin tmp.symlinks/absolute_symlink");
system("ln -s foo.txt tmp.symlinks/file");
system("ln -s file tmp.symlinks/file2");
system("ln -s file2 tmp.symlinks/file3");
ensure_equals(resolveSymlink("tmp.symlinks/file"), "tmp.symlinks/foo.txt");
ensure_equals(resolveSymlink("tmp.symlinks/file2"), "tmp.symlinks/file");
ensure_equals(resolveSymlink("tmp.symlinks/file3"), "tmp.symlinks/file2");
ensure_equals(resolveSymlink("tmp.symlinks/absolute_symlink"), "/usr/bin");
}
}
1 change: 0 additions & 1 deletion test/stub/symlinks/absolute_symlink

This file was deleted.

1 change: 0 additions & 1 deletion test/stub/symlinks/file

This file was deleted.

1 change: 0 additions & 1 deletion test/stub/symlinks/file2

This file was deleted.

1 change: 0 additions & 1 deletion test/stub/symlinks/file3

This file was deleted.

Empty file removed test/stub/symlinks/foo.txt
Empty file.
40 changes: 40 additions & 0 deletions test/support/Support.h
@@ -0,0 +1,40 @@
#ifndef _TEST_SUPPORT_H_
#define _TEST_SUPPORT_H_

#include <sys/stat.h>
#include <sys/types.h>
#include <iostream>
#include <string>
#include <exception>
#include <cerrno>
#include <cstring>

namespace Test {

using namespace std;

class TempDir {
private:
string name;
public:
TempDir(const string &name) {
this->name = name;
if (mkdir(name.c_str(), S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) != 0) {
int e = errno;
cerr << "Cannot create directory '" << name << "': " <<
strerror(e) <<" (" << e << ")" << endl;
throw exception();
}
}

~TempDir() {
string command("rm -rf \"");
command.append(name);
command.append("\"");
system(command.c_str());
}
};

} // namespace Test

#endif /* _TEST_SUPPORT_H_ */

0 comments on commit 202d8d8

Please sign in to comment.