Skip to content

Commit af9c19f

Browse files
authored
Fix and re-enable ctest desktop tests on x86 (#1043)
1 parent fdb50b0 commit af9c19f

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

.github/workflows/desktop.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,21 +234,20 @@ jobs:
234234
LANG: en_US
235235
run: |
236236
cd build
237-
ctest --repeat until-pass:3
237+
ctest --repeat until-pass:3 --output-on-failure
238238
239239
- name: Run unit tests (linux)
240240
# Linux exists as its own standalone execution step in order to invoke
241241
# platform-specific `ulimit` to enable crash collection. The ulimit
242242
# command must be invoked in same shell instance of that runs the
243243
# tests.
244-
# TODO: Enable tests for x86 once they are all working
245-
if: startsWith(matrix.os, 'ubuntu') && matrix.architecture != 'x86'
244+
if: startsWith(matrix.os, 'ubuntu')
246245
env:
247246
LANG: en_US
248247
run: |
249248
ulimit -c unlimited
250249
cd build
251-
sudo ctest --repeat until-pass:3
250+
sudo ctest --repeat until-pass:3 --output-on-failure
252251
253252
- name: Prep bins for achive (linux)
254253
# Copies all of the binary files into one directory for ease in

app/tests/time_test.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818

1919
#include <time.h>
2020

21+
#include <iostream>
22+
#include <string>
23+
2124
#include "gmock/gmock.h"
2225
#include "gtest/gtest.h"
2326

@@ -86,11 +89,8 @@ TEST(TimeTests, GetTimestampEpochTest) {
8689

8790
// Print out the epoch time so that we can verify the timestamp from the log
8891
// This is the easiest way to verify if the function works in all platform
89-
#ifdef __linux__
90-
printf("%lu -> %lu (%ld)\n", start, end, error);
91-
#else
92-
printf("%llu -> %llu (%lld)\n", start, end, error);
93-
#endif // __linux__
92+
std::cout << std::to_string(start) << " -> " << std::to_string(end) << " ("
93+
<< std::to_string(error) << ")" << std::endl;
9494

9595
EXPECT_GE(end, start + 500);
9696
}

database/tests/desktop/core/server_values_test.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ TEST(ServerValues, ServerTimestamp) {
3737
}
3838

3939
TEST(ServerValues, GenerateServerValues) {
40-
int64_t current_time_ms = time(nullptr) * 1000;
40+
int64_t current_time_ms = static_cast<int64_t>(time(nullptr)) * 1000L;
4141

4242
Variant result = GenerateServerValues(0);
4343

@@ -50,7 +50,7 @@ TEST(ServerValues, GenerateServerValues) {
5050
}
5151

5252
TEST(ServerValues, GenerateServerValuesWithTimeOffset) {
53-
int64_t current_time_ms = time(nullptr) * 1000;
53+
int64_t current_time_ms = static_cast<int64_t>(time(nullptr)) * 1000L;
5454

5555
Variant result = GenerateServerValues(5000);
5656

@@ -160,7 +160,7 @@ TEST(ServerValues, ResolveDeferredValueNestedMap) {
160160
}
161161

162162
TEST(ServerValues, ResolveDeferredValueTimestamp) {
163-
int64_t current_time_ms = time(nullptr) * 1000;
163+
int64_t current_time_ms = static_cast<int64_t>(time(nullptr)) * 1000L;
164164
Variant timestamp = ServerTimestamp();
165165
Variant server_values = GenerateServerValues(0);
166166

@@ -171,7 +171,7 @@ TEST(ServerValues, ResolveDeferredValueTimestamp) {
171171
}
172172

173173
TEST(ServerValues, ResolveDeferredValueSnapshot) {
174-
int64_t current_time_ms = time(nullptr) * 1000;
174+
int64_t current_time_ms = static_cast<int64_t>(time(nullptr)) * 1000L;
175175
Variant nested_map_variant = std::map<Variant, Variant>{
176176
std::make_pair("aaa", 100),
177177
std::make_pair("bbb", 200),
@@ -196,7 +196,7 @@ TEST(ServerValues, ResolveDeferredValueSnapshot) {
196196
}
197197

198198
TEST(ServerValues, ResolveDeferredValueMerge) {
199-
int64_t current_time_ms = time(nullptr) * 1000;
199+
int64_t current_time_ms = static_cast<int64_t>(time(nullptr)) * 1000L;
200200
Variant merge(std::map<Variant, Variant>{
201201
std::make_pair("aaa", 100),
202202
std::make_pair("bbb", 200),

0 commit comments

Comments
 (0)