src: Fixed tests for Mac

This commit is contained in:
Eberhard Graether
2018-09-21 14:38:31 +02:00
parent dfc6d88432
commit 513988e51b
13 changed files with 7 additions and 205 deletions
@@ -6,12 +6,12 @@ SourceFilePath: "src/Test.cpp"
CompilerFlag: "-fms-compatibility"
CompilerFlag: "-fms-compatibility-version=19"
CompilerFlag: "-isystem"
CompilerFlag: "'/include/path/from/cdb'"
CompilerFlag: "/include/path/from/cdb"
CompilerFlag: "-D"
CompilerFlag: "DEFINE_FROM_CDB=some_value"
CompilerFlag: "-std=c++14"
CompilerFlag: "/FS"
CompilerFlag: "'./Test.cpp'"
CompilerFlag: "./Test.cpp"
CompilerFlag: "-isystem"
CompilerFlag: "header_search/local"
CompilerFlag: "-isystem"
@@ -1,7 +1,7 @@
[
{
"directory": "src",
"command": "clang-tool -fms-extensions -fms-compatibility -fms-compatibility-version=19 -isystem '/include/path/from/cdb' -D DEFINE_FROM_CDB=\"some_value\" -std=c++14 /FS './Test.cpp'",
"command": "clang-tool -fms-extensions -fms-compatibility -fms-compatibility-version=19 -isystem /include/path/from/cdb -D DEFINE_FROM_CDB=\"some_value\" -std=c++14 /FS ./Test.cpp",
"file": "./Test.cpp"
}
]
+1 -10
View File
@@ -425,7 +425,7 @@ add_files(
utility/messaging/filter_types/MessageFilterSearchAutocomplete.h
utility/messaging/type/activation/MessageActivateLegend.h
utility/messaging/type/code/MessageCodeShowDefinition.h
utility/messaging/type/error/MessageActivateErrors.h
@@ -577,15 +577,6 @@ add_files(
utility/sonargraph/utilitySonargraph.cpp
utility/sonargraph/utilitySonargraph.h
utility/synchronization/ReaderWriterLock.cpp
utility/synchronization/ReaderWriterLock.h
utility/synchronization/ScopedReaderLock.cpp
utility/synchronization/ScopedReaderLock.h
utility/synchronization/ScopedWriterLock.cpp
utility/synchronization/ScopedWriterLock.h
utility/synchronization/Semaphore.cpp
utility/synchronization/Semaphore.h
utility/text/TextAccess.cpp
utility/text/TextAccess.h
@@ -1,54 +0,0 @@
#include "ReaderWriterLock.h"
ReaderWriterLock::ReaderWriterLock()
: m_readerCount(0)
, m_allowedReaders(1)
, m_allowedWriters(1)
{
}
ReaderWriterLock::ReaderWriterLock(const ReaderWriterLock &lock)
: m_readerCount(0)
, m_allowedReaders(1)
, m_allowedWriters(1)
{
}
ReaderWriterLock::~ReaderWriterLock()
{
}
void ReaderWriterLock::readerLock()
{
m_allowedReaders.wait();
m_allowedReaders.post();
std::lock_guard<std::mutex> lock(m_readerCountMutex);
m_readerCount++;
if (m_readerCount == 1)
{
m_allowedWriters.wait();
}
}
void ReaderWriterLock::readerUnlock()
{
std::lock_guard<std::mutex> lock(m_readerCountMutex);
m_readerCount--;
if (m_readerCount == 0)
{
m_allowedWriters.post();
}
}
void ReaderWriterLock::writerLock()
{
m_allowedReaders.wait();
m_allowedWriters.wait();
}
void ReaderWriterLock::writerUnlock()
{
m_allowedWriters.post();
m_allowedReaders.post();
}
@@ -1,30 +0,0 @@
#ifndef READER_WRITER_LOCK_H
#define READER_WRITER_LOCK_H
#include <mutex>
#include "Semaphore.h"
class ReaderWriterLock
{
public:
ReaderWriterLock();
private:
ReaderWriterLock(const ReaderWriterLock &lock);
public:
~ReaderWriterLock();
void readerLock();
void readerUnlock();
void writerLock();
void writerUnlock();
private:
int m_readerCount;
std::mutex m_readerCountMutex;
Semaphore m_allowedReaders, m_allowedWriters;
};
#endif // READER_WRITER_LOCK_H
@@ -1,12 +0,0 @@
#include "ScopedReaderLock.h"
ScopedReaderLock::ScopedReaderLock(ReaderWriterLock& lock)
: m_lock(lock)
{
m_lock.readerLock();
}
ScopedReaderLock::~ScopedReaderLock()
{
m_lock.readerUnlock();
}
@@ -1,16 +0,0 @@
#ifndef SCOPED_READER_LOCK_H
#define SCOPED_READER_LOCK_H
#include "ReaderWriterLock.h"
class ScopedReaderLock
{
public:
ScopedReaderLock(ReaderWriterLock& lock);
~ScopedReaderLock();
private:
ReaderWriterLock& m_lock;
};
#endif // SCOPED_READER_LOCK_H
@@ -1,12 +0,0 @@
#include "ScopedWriterLock.h"
ScopedWriterLock::ScopedWriterLock(ReaderWriterLock& lock)
: m_lock(lock)
{
m_lock.writerLock();
}
ScopedWriterLock::~ScopedWriterLock()
{
m_lock.writerUnlock();
}
@@ -1,16 +0,0 @@
#ifndef SCOPED_WRITER_LOCK_H
#define SCOPED_WRITER_LOCK_H
#include "ReaderWriterLock.h"
class ScopedWriterLock
{
public:
ScopedWriterLock(ReaderWriterLock& lock);
~ScopedWriterLock();
private:
ReaderWriterLock& m_lock;
};
#endif // SCOPED_WRITER_LOCK_H
@@ -1,27 +0,0 @@
#include "Semaphore.h"
Semaphore::Semaphore(unsigned int counter)
: m_counter(counter)
{
}
Semaphore::~Semaphore()
{
}
void Semaphore::wait()
{
std::unique_lock<std::mutex> lock(m_counterMutex);
while(m_counter == 0)
{
m_conditionVariable.wait(lock);
}
m_counter--;
}
void Semaphore::post()
{
std::unique_lock<std::mutex> lock(m_counterMutex);
m_counter++;
m_conditionVariable.notify_one();
}
@@ -1,22 +0,0 @@
#ifndef SEMAPHORE_H
#define SEMAPHORE_H
#include <mutex>
#include <condition_variable>
class Semaphore
{
public:
Semaphore(unsigned int counter);
~Semaphore();
void wait();
void post();
private:
unsigned int m_counter;
std::mutex m_counterMutex;
std::condition_variable m_conditionVariable;
};
#endif // SEMAPHORE_H
@@ -275,7 +275,7 @@ namespace Codeblocks
sourceGroupSettings->getCodeblocksProjectPathExpandedAndAbsolute().getParentDirectory(),
utility::concat(
optionsCache.getValue(targetName),
{ IndexerCommandCxx::getCompilerFlagLanguageStandard(languageStandard), filePath.wstr() }
std::vector<std::wstring>({ IndexerCommandCxx::getCompilerFlagLanguageStandard(languageStandard), filePath.wstr() })
)
));
}
+2 -2
View File
@@ -436,12 +436,12 @@ public:
private:
static FilePath getInputDirectoryPath(const std::wstring& projectName)
{
return FilePath(L"data/SourceGroupTestSuite/" + projectName + L"/input").makeAbsolute();
return FilePath(L"data/SourceGroupTestSuite/" + projectName + L"/input").makeAbsolute().makeCanonical();
}
static FilePath getOutputDirectoryPath(const std::wstring& projectName)
{
return FilePath(L"data/SourceGroupTestSuite/" + projectName + L"/expected_output").makeAbsolute();
return FilePath(L"data/SourceGroupTestSuite/" + projectName + L"/expected_output").makeAbsolute().makeCanonical();
}
std::string setupJavaEnvironmentFactory()