Skip to content

Commit

Permalink
Merge branch 'master' of github.com:simdjson/simdjson
Browse files Browse the repository at this point in the history
  • Loading branch information
lemire committed Jun 11, 2024
2 parents d9d1ff5 + eb8f2bc commit d017cd7
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 6 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/ubuntu24.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Ubuntu 24.04 CI

on: [push, pull_request]
jobs:
ubuntu-build:
if: >-
! contains(toJSON(github.event.commits.*.message), '[skip ci]') &&
! contains(toJSON(github.event.commits.*.message), '[skip github]')
runs-on: ubuntu-24.04
strategy:
matrix:
shared: [ON, OFF]
cxx: [g++-13, clang++-16]
sanitizer: [ON, OFF]
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- name: Prepare
run: cmake -DSIMDJSON_DEVELOPER_MODE=ON -DSIMDJSON_SANITIZE=${{matrix.sanitizer}} -DBUILD_SHARED_LIBS=${{matrix.shared}} -B build
env:
CXX: ${{matrix.cxx}}
- name: Build
run: cmake --build build -j=2
- name: Test
run: ctest --output-on-failure --test-dir build
30 changes: 24 additions & 6 deletions tests/ondemand/ondemand_misc_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,22 @@ using namespace simdjson;

namespace misc_tests {
using namespace std;
#if SIMDJSON_EXCEPTIONS
// user reported an asan error:
bool issue2199() {
TEST_START();
static constexpr std::string_view kJsonString = R"( { "name": "name", "version": 100, } )";
try {
simdjson::padded_string buffer{kJsonString};
simdjson::ondemand::parser parser;
simdjson::ondemand::document document = parser.iterate(buffer);
(void)document;
} catch (simdjson::simdjson_error& /*error*/) {
std::cerr << "Caught simdjson_error" << std::endl;
}
TEST_SUCCEED();
}
#endif
bool issue1981_success() {
auto error_phrase = R"(false)"_padded;
TEST_START();
Expand Down Expand Up @@ -532,7 +548,7 @@ namespace misc_tests {
string_view token;
ASSERT_SUCCESS(o["value"].raw_json_token().get(token));
ASSERT_EQUAL(token, "12321323213213213213213213213211223");
return true;
TEST_SUCCEED();
}
simdjson_warn_unused bool big_integer_in_string() {
TEST_START();
Expand All @@ -545,7 +561,7 @@ namespace misc_tests {
string_view token;
ASSERT_SUCCESS(o["value"].raw_json_token().get(token));
ASSERT_EQUAL(token, "\"12321323213213213213213213213211223\"");
return true;
TEST_SUCCEED();
}
simdjson_warn_unused bool test_raw_json_token(string_view json, string_view expected_token, int expected_start_index = 0) {
string title("'");
Expand All @@ -558,7 +574,7 @@ namespace misc_tests {
ASSERT_EQUAL( token, expected_token );
// Validate the text is inside the original buffer
ASSERT_EQUAL( reinterpret_cast<const void*>(token.data()), reinterpret_cast<const void*>(&json_padded.data()[expected_start_index]));
return true;
TEST_SUCCEED();
}));

// Test values
Expand All @@ -576,10 +592,9 @@ namespace misc_tests {
// Validate the text is inside the original buffer
// Adjust for the {"a":
ASSERT_EQUAL( reinterpret_cast<const void*>(token.data()), reinterpret_cast<const void*>(&json_padded.data()[5+expected_start_index]));
return true;
TEST_SUCCEED();
}));

return true;
TEST_SUCCEED();
}

bool raw_json_token() {
Expand All @@ -605,6 +620,9 @@ namespace misc_tests {

bool run() {
return
#if SIMDJSON_EXCEPTIONS
issue2199() &&
#endif
skipbom() &&
issue1981_success() &&
issue1981_failure() &&
Expand Down

0 comments on commit d017cd7

Please sign in to comment.