Skip to content

Commit c91d458

Browse files
Georges Berengerfacebook-github-bot
Georges Berenger
authored andcommitted
Fix stricter fbcode compiler settings
Summary: Apparently, the compiler settings are now stricter. Reviewed By: hanghu Differential Revision: D69677824 fbshipit-source-id: 1533f17e6b15c8d0c1a0955005c2f449f6ab33c6
1 parent caec653 commit c91d458

10 files changed

+48
-15
lines changed

sample_apps/SampleRecordingApp.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ using namespace vrs_sample_apps;
3636
namespace vrs_sample_apps {
3737

3838
// Use your own clock source.
39-
double getTimestampSec() {
39+
static double getTimestampSec() {
4040
using namespace std::chrono;
4141
return duration_cast<duration<double>>(steady_clock::now().time_since_epoch()).count();
4242
}

tools/vrs/test/VrsCommandTest.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ using coretech::getTestDataDir;
3434

3535
struct VrsCommandTest : testing::Test {};
3636

37-
bool parse(VrsCommand& command, vector<string>& args, int& argn, int& outStatusCode) {
37+
static bool parse(VrsCommand& command, vector<string>& args, int& argn, int& outStatusCode) {
3838
argn = 0;
3939
outStatusCode = EXIT_SUCCESS;
4040
vector<char*> argvs(args.size());

vrs/test/GetRecordTest.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,9 @@ struct GetRecordTester : testing::Test {
3737
string kTestFile3 = os::pathJoin(coretech::getTestDataDir(), "VRS_Files/chunks.vrs");
3838
string kTestFile4 = os::pathJoin(coretech::getTestDataDir(), "VRS_Files/chunks-shuffled.vrs");
3939
};
40-
} // namespace
4140

4241
// legacy implementation, without caching
43-
static const IndexRecord::RecordInfo* getRecord(
42+
const IndexRecord::RecordInfo* getRecord(
4443
vrs::RecordFileReader& file,
4544
StreamId streamId,
4645
Record::Type recordType,
@@ -58,8 +57,7 @@ static const IndexRecord::RecordInfo* getRecord(
5857
return nullptr;
5958
}
6059

61-
inline void
62-
check(vrs::RecordFileReader& file, StreamId id, Record::Type type, uint32_t indexNumber) {
60+
void check(vrs::RecordFileReader& file, StreamId id, Record::Type type, uint32_t indexNumber) {
6361
// Compare the old method and the new method
6462
const IndexRecord::RecordInfo* ref = getRecord(file, id, type, indexNumber);
6563
EXPECT_EQ(ref, file.getRecord(id, type, indexNumber));
@@ -68,7 +66,7 @@ check(vrs::RecordFileReader& file, StreamId id, Record::Type type, uint32_t inde
6866
EXPECT_EQ(ref, file.getRecord(id, type, indexNumber));
6967
}
7068

71-
static bool isCloserThan(
69+
bool isCloserThan(
7270
const IndexRecord::RecordInfo& closer,
7371
double timestamp,
7472
const IndexRecord::RecordInfo& farther) {
@@ -226,6 +224,8 @@ void checkIndex(vrs::RecordFileReader& file, uint32_t recordIndex) {
226224
EXPECT_NE(r, nullptr);
227225
}
228226

227+
} // namespace
228+
229229
TEST_F(GetRecordTester, GetRecordTest) {
230230
vrs::RecordFileReader file;
231231
EXPECT_EQ(file.openFile(kTestFile), 0);

vrs/test/MultiRecordFileReaderTest.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ class TestRecordable : public Recordable {
107107
MyMetadata metadata_;
108108
};
109109

110+
namespace {
111+
110112
struct VrsFileBuilder {
111113
explicit VrsFileBuilder(string path) : path_{std::move(path)} {
112114
XR_CHECK_FALSE(os::isFile(path_));
@@ -237,6 +239,8 @@ class RecordFormatTestStreamPlayer : public RecordFormatStreamPlayer {
237239
int counter{};
238240
};
239241

242+
} // namespace
243+
240244
class MultiRecordFileReaderTest : public testing::Test {};
241245

242246
TEST_F(MultiRecordFileReaderTest, invalidFilePaths) {
@@ -285,6 +289,8 @@ TEST_F(MultiRecordFileReaderTest, relatedFiles) {
285289
removeFiles(unrelatedFilePaths);
286290
}
287291

292+
namespace {
293+
288294
vector<double> getNonDecreasingTimestamps(
289295
const size_t count,
290296
const double startTimestamp = 0,
@@ -299,6 +305,8 @@ vector<double> getNonDecreasingTimestamps(
299305
return timestamps;
300306
}
301307

308+
} // namespace
309+
302310
TEST_F(MultiRecordFileReaderTest, multiFile) {
303311
const auto expectedTimestamps = getNonDecreasingTimestamps(50);
304312
const auto filePaths = getOsTempPaths(4);

vrs/test/RecordFormatTest.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@ class TestRecordable : public Recordable {
6262
}
6363
};
6464

65-
} // namespace
66-
6765
#define FORMAT_EQUAL(_block_format, _cstring) \
6866
EXPECT_STREQ((_block_format).asString().c_str(), _cstring)
6967

@@ -112,6 +110,8 @@ bool checkImageHeights(
112110
XR_VERIFY(spec.getPlaneHeight(3) == height3) && XR_VERIFY(spec.getPlaneHeight(4) == 0);
113111
}
114112

113+
} // namespace
114+
115115
TEST_F(RecordFormatTest, testBlockFormat) {
116116
ContentBlock emptyString("");
117117
EXPECT_EQ(emptyString.getContentType(), ContentType::CUSTOM);

vrs/test/RecordTest.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ TEST_F(RecordTester, indexSortTest) {
231231
checkIndexOrder(records);
232232
}
233233

234-
void checkSortOrder(const vector<RecordFileWriter::SortRecord>& records) {
234+
static void checkSortOrder(const vector<RecordFileWriter::SortRecord>& records) {
235235
for (size_t first = 0; first < records.size(); first++) {
236236
for (size_t second = first + 1; second < records.size(); second++) {
237237
EXPECT_TRUE(records[first] < records[second]);

vrs/test/file_tests/DeviceSimulatorTest.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ struct ChunkCollector : public NewChunkHandler {
219219
map<size_t, string>& chunks;
220220
};
221221

222-
void checkChunks(const map<size_t, string>& chunks, const string& path, size_t count) {
222+
static void checkChunks(const map<size_t, string>& chunks, const string& path, size_t count) {
223223
EXPECT_EQ(chunks.size(), count);
224224
if (!chunks.empty()) {
225225
auto iter = chunks.begin();

vrs/test/file_tests/FileCacheTest.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ TEST_F(FileCacheTest, cacheDomainTest) {
9191
EXPECT_EQ(fcache->getFile(domain, "123.txt", location2), INVALID_DISK_DATA);
9292
}
9393

94+
namespace {
95+
9496
void verifyDetails(
9597
const string& cacheFile,
9698
const RecordFileReader& reader,
@@ -140,6 +142,8 @@ void createRecordsThreadTask(ThreadParam* param) {
140142
testDetails(param->cacheFile, param->reader, param->hasIndex, true);
141143
}
142144

145+
} // namespace
146+
143147
TEST_F(FileCacheTest, detailsTest) {
144148
string kTestFile = os::pathJoin(coretech::getTestDataDir(), "VRS_Files/sample_file.vrs");
145149
const string cacheFile = os::getTempFolder() + "detailsTest.vrsi";

vrs/test/helpers/VRSTestsHelpers.cpp

+17
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,23 @@ using namespace std;
3434
using namespace vrs;
3535
using namespace vrs::test;
3636

37+
namespace vrs::test {
38+
39+
const FileConfig& getClassicFileConfig() {
40+
static const FileConfig sClassicFileConfig(30, 100);
41+
return sClassicFileConfig;
42+
}
43+
const FileConfig& getLongFileConfig() {
44+
static const FileConfig sLongFileConfig(30, 20000);
45+
return sLongFileConfig;
46+
}
47+
const FileConfig& getVeryLongFileConfig() {
48+
static const FileConfig sVeryLongFileConfig(90, 60000);
49+
return sVeryLongFileConfig;
50+
}
51+
52+
} // namespace vrs::test
53+
3754
namespace {
3855

3956
// Detect if there was any attempt to got back in the file

vrs/test/helpers/VRSTestsHelpers.h

+8-4
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,18 @@ struct FileConfig {
8484
totalRecordCount = kCameraCount * (2 + frameCount);
8585
}
8686
uint32_t frameRate;
87-
uint32_t simulationDurationMs = 100;
87+
uint32_t simulationDurationMs;
8888
size_t frameCount;
8989
size_t totalRecordCount;
9090
};
9191

92-
const FileConfig kClassicFileConfig(30, 100);
93-
const FileConfig kLongFileConfig(30, 20000);
94-
const FileConfig kVeryLongFileConfig(90, 60000);
92+
const FileConfig& getClassicFileConfig();
93+
const FileConfig& getLongFileConfig();
94+
const FileConfig& getVeryLongFileConfig();
95+
96+
#define kClassicFileConfig test::getClassicFileConfig()
97+
#define kLongFileConfig test::getLongFileConfig()
98+
#define kVeryLongFileConfig test::getVeryLongFileConfig()
9599

96100
/// Parameterization of the VRS file creation, so we can simulate a wide variety of cases.
97101
struct CreateParams {

0 commit comments

Comments
 (0)