Compare commits

..

9 Commits

Author SHA1 Message Date
Bronek Kozicki
7d90d6311e DO NOT MERGE 2025-08-08 17:52:51 +01:00
JCW
205d2965da Fix name and formatting
Signed-off-by: JCW <a1q123456@users.noreply.github.com>
2025-08-08 16:40:34 +01:00
JCW
c40ca84363 Fix comments
Signed-off-by: JCW <a1q123456@users.noreply.github.com>
2025-08-08 16:38:06 +01:00
JCW
1fd24c31d3 Revert unnecessary change and update unit test
Signed-off-by: JCW <a1q123456@users.noreply.github.com>
2025-08-08 15:53:03 +01:00
JCW
96d0fcfbd1 Add unit tests
Signed-off-by: JCW <a1q123456@users.noreply.github.com>
2025-08-08 15:47:04 +01:00
Bronek Kozicki
73c83dfcad Merge branch 'develop' into a1q123456/optimise-xxhash 2025-08-08 15:26:42 +01:00
JCW
5dcd2e9d06 Fix formatting
Signed-off-by: JCW <a1q123456@users.noreply.github.com>
2025-08-08 15:17:27 +01:00
JCW
7d8a35c97d Address comments
Signed-off-by: JCW <a1q123456@users.noreply.github.com>
2025-08-08 15:13:26 +01:00
Bart
39b5031ab5 Switch Conan 1 commands to Conan 2 and fix credentials (#5655)
This change updates some incorrect Conan commands for Conan 2. As some flags do not exist in Conan 2, such as --settings build_type=[configuration], the commands have been adjusted accordingly. This change further uses the org-level variables and secrets rather than the repo-level ones.
2025-08-08 12:47:36 +00:00
7 changed files with 95 additions and 52 deletions

View File

@@ -2,33 +2,25 @@ name: dependencies
inputs:
configuration:
required: true
# An implicit input is the environment variable `build_dir`.
# Implicit inputs are the environment variables `build_dir`, CONAN_REMOTE_URL,
# CONAN_REMOTE_USERNAME, and CONAN_REMOTE_PASSWORD. The latter two are only
# used to upload newly built dependencies to the Conan remote.
runs:
using: composite
steps:
- name: add Conan remote
if: env.CONAN_URL != ''
if: ${{ env.CONAN_REMOTE_URL != '' }}
shell: bash
run: |
if conan remote list | grep -q 'xrplf'; then
conan remote update --index 0 --url ${CONAN_URL} xrplf
echo "Updated Conan remote 'xrplf' to ${CONAN_URL}."
else
conan remote add --index 0 xrplf ${CONAN_URL}
echo "Added new Conan remote 'xrplf' at ${CONAN_URL}."
fi
- name: list missing binaries
id: binaries
shell: bash
# Print the list of dependencies that would need to be built locally.
# A non-empty list means we have "failed" to cache binaries remotely.
run: |
echo missing=$(conan info . --build missing --settings build_type=${{ inputs.configuration }} --json 2>/dev/null | grep '^\[') | tee ${GITHUB_OUTPUT}
echo "Adding Conan remote 'xrplf' at ${{ env.CONAN_REMOTE_URL }}."
conan remote add --index 0 --force xrplf ${{ env.CONAN_REMOTE_URL }}
echo "Listing Conan remotes."
conan remote list
- name: install dependencies
shell: bash
run: |
mkdir ${build_dir}
cd ${build_dir}
mkdir -p ${{ env.build_dir }}
cd ${{ env.build_dir }}
conan install \
--output-folder . \
--build missing \
@@ -37,10 +29,10 @@ runs:
--settings:all build_type=${{ inputs.configuration }} \
..
- name: upload dependencies
if: ${{ env.CONAN_URL != '' && env.CONAN_LOGIN_USERNAME_XRPLF != '' && env.CONAN_PASSWORD_XRPLF != '' && github.ref_type == 'branch' && github.ref_name == github.event.repository.default_branch }}
if: ${{ env.CONAN_REMOTE_URL != '' && env.CONAN_REMOTE_USERNAME != '' && env.CONAN_REMOTE_PASSWORD != '' && github.ref_type == 'branch' && github.ref_name == github.event.repository.default_branch }}
shell: bash
run: |
echo "Logging into Conan remote 'xrplf' at ${CONAN_URL}."
conan remote login xrplf "${{ env.CONAN_LOGIN_USERNAME_XRPLF }}" --password "${{ env.CONAN_PASSWORD_XRPLF }}"
echo "Uploading dependencies for configuration '${{ inputs.configuration }}'."
conan upload --all --confirm --remote xrplf . --settings build_type=${{ inputs.configuration }}
echo "Logging into Conan remote 'xrplf' at ${{ env.CONAN_REMOTE_URL }}."
conan remote login xrplf "${{ env.CONAN_REMOTE_USERNAME }}" --password "${{ env.CONAN_REMOTE_PASSWORD }}"
echo "Uploading dependencies."
conan upload '*' --confirm --check --remote xrplf

View File

@@ -1,8 +1,8 @@
name: Check libXRPL compatibility with Clio
env:
CONAN_URL: https://conan.ripplex.io
CONAN_LOGIN_USERNAME_XRPLF: ${{ secrets.CONAN_USERNAME }}
CONAN_PASSWORD_XRPLF: ${{ secrets.CONAN_TOKEN }}
CONAN_REMOTE_URL: ${{ vars.CONAN_REMOTE_URL }}
CONAN_LOGIN_USERNAME_XRPLF: ${{ secrets.CONAN_REMOTE_USERNAME }}
CONAN_PASSWORD_XRPLF: ${{ secrets.CONAN_REMOTE_PASSWORD }}
on:
pull_request:
paths:
@@ -46,10 +46,10 @@ jobs:
- name: Add Conan remote
shell: bash
run: |
echo "Adding Conan remote 'xrplf' at ${{ env.CONAN_REMOTE_URL }}."
conan remote add xrplf ${{ env.CONAN_REMOTE_URL }} --insert 0 --force
echo "Listing Conan remotes."
conan remote list
conan remote remove xrplf || true
# Do not quote the URL. An empty string will be accepted (with a non-fatal warning), but a missing argument will not.
conan remote add xrplf ${{ env.CONAN_URL }} --insert 0
- name: Parse new version
id: version
shell: bash

View File

@@ -18,9 +18,12 @@ concurrency:
# This part of Conan configuration is specific to this workflow only; we do not want
# to pollute conan/profiles directory with settings which might not work for others
env:
CONAN_URL: https://conan.ripplex.io
CONAN_LOGIN_USERNAME_XRPLF: ${{ secrets.CONAN_USERNAME }}
CONAN_PASSWORD_XRPLF: ${{ secrets.CONAN_TOKEN }}
CONAN_REMOTE_URL: ${{ vars.CONAN_REMOTE_URL }}
CONAN_REMOTE_USERNAME: ${{ secrets.CONAN_REMOTE_USERNAME }}
CONAN_REMOTE_PASSWORD: ${{ secrets.CONAN_REMOTE_PASSWORD }}
# This part of the Conan configuration is specific to this workflow only; we
# do not want to pollute the 'conan/profiles' directory with settings that
# might not work for other workflows.
CONAN_GLOBAL_CONF: |
core.download:parallel={{os.cpu_count()}}
core.upload:parallel={{os.cpu_count()}}

View File

@@ -16,12 +16,13 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# This part of Conan configuration is specific to this workflow only; we do not want
# to pollute conan/profiles directory with settings which might not work for others
env:
CONAN_URL: https://conan.ripplex.io
CONAN_LOGIN_USERNAME_XRPLF: ${{ secrets.CONAN_USERNAME }}
CONAN_PASSWORD_XRPLF: ${{ secrets.CONAN_TOKEN }}
CONAN_REMOTE_URL: ${{ vars.CONAN_REMOTE_URL }}
CONAN_REMOTE_USERNAME: ${{ secrets.CONAN_REMOTE_USERNAME }}
CONAN_REMOTE_PASSWORD: ${{ secrets.CONAN_REMOTE_PASSWORD }}
# This part of the Conan configuration is specific to this workflow only; we
# do not want to pollute the 'conan/profiles' directory with settings that
# might not work for other workflows.
CONAN_GLOBAL_CONF: |
core.download:parallel={{ os.cpu_count() }}
core.upload:parallel={{ os.cpu_count() }}

View File

@@ -18,12 +18,13 @@ on:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# This part of Conan configuration is specific to this workflow only; we do not want
# to pollute conan/profiles directory with settings which might not work for others
env:
CONAN_URL: https://conan.ripplex.io
CONAN_LOGIN_USERNAME_XRPLF: ${{ secrets.CONAN_USERNAME }}
CONAN_PASSWORD_XRPLF: ${{ secrets.CONAN_TOKEN }}
CONAN_REMOTE_URL: ${{ vars.CONAN_REMOTE_URL }}
CONAN_REMOTE_USERNAME: ${{ secrets.CONAN_REMOTE_USERNAME }}
CONAN_REMOTE_PASSWORD: ${{ secrets.CONAN_REMOTE_PASSWORD }}
# This part of the Conan configuration is specific to this workflow only; we
# do not want to pollute the 'conan/profiles' directory with settings that
# might not work for other workflows.
CONAN_GLOBAL_CONF: |
core.download:parallel={{os.cpu_count()}}
core.upload:parallel={{os.cpu_count()}}

View File

@@ -36,10 +36,10 @@ class xxhasher
{
public:
using result_type = std::size_t;
static int volatile test;
private:
static_assert(sizeof(std::size_t) == 8, "requires 64-bit std::size_t");
// Have an internal buffer to avoid the streaming API
// A 64-byte buffer should to be big enough for us
static constexpr std::size_t INTERNAL_BUFFER_SIZE = 64;
@@ -144,6 +144,7 @@ public:
{
if (state_)
{
test = test + 1;
XXH3_freeState(state_);
}
}

View File

@@ -22,13 +22,15 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
namespace beast {
int volatile xxhasher::test = 0;
class XXHasher_test : public unit_test::suite
{
public:
void
testWithoutSeed()
{
testcase("Without Seed");
testcase("Without seed");
xxhasher hasher{};
@@ -43,7 +45,7 @@ public:
void
testWithSeed()
{
testcase("With Seed");
testcase("With seed");
xxhasher hasher{static_cast<std::uint32_t>(102)};
@@ -58,7 +60,7 @@ public:
void
testWithTwoSeeds()
{
testcase("With Two Seeds");
testcase("With two seeds");
xxhasher hasher{
static_cast<std::uint32_t>(102), static_cast<std::uint32_t>(103)};
@@ -73,7 +75,7 @@ public:
void
testBigObjectWithMultiupleSmallUpdatesWithoutSeed()
{
testcase("Big Object With Multiuple Small Updates Without Seed");
testcase("Big object with multiple small updates without seed");
xxhasher hasher{};
std::string objectToHash{"Hello, xxHash!"};
@@ -90,7 +92,7 @@ public:
void
testBigObjectWithMultiupleSmallUpdatesWithSeed()
{
testcase("Big Object With Multiuple Small Updates With Seed");
testcase("Big object with multiple small updates with seed");
xxhasher hasher{static_cast<std::uint32_t>(103)};
std::string objectToHash{"Hello, xxHash!"};
@@ -102,12 +104,14 @@ public:
BEAST_EXPECT(
static_cast<xxhasher::result_type>(hasher) ==
17285302196561698791ULL);
BEAST_EXPECT(xxhasher::test > 0);
}
void
testBigObjectWithSmallAndBigUpdatesWithoutSeed()
{
testcase("Big Object With Small And Big Updates Without Seed");
testcase("Big object with small and big updates without seed");
xxhasher hasher{};
std::string objectToHash{"Hello, xxHash!"};
@@ -123,12 +127,14 @@ public:
BEAST_EXPECT(
static_cast<xxhasher::result_type>(hasher) ==
1865045178324729219ULL);
BEAST_EXPECT(xxhasher::test > 0);
}
void
testBigObjectWithSmallAndBigUpdatesWithSeed()
{
testcase("Big Object With Small And Big Updates With Seed");
testcase("Big object with small and big updates with seed");
xxhasher hasher{static_cast<std::uint32_t>(103)};
std::string objectToHash{"Hello, xxHash!"};
@@ -144,12 +150,14 @@ public:
BEAST_EXPECT(
static_cast<xxhasher::result_type>(hasher) ==
16189862915636005281ULL);
BEAST_EXPECT(xxhasher::test > 0);
}
void
testBigObjectWithOneUpdateWithoutSeed()
{
testcase("Big Object With One Update Without Seed");
testcase("Big object with one update without seed");
xxhasher hasher{};
std::string objectToHash;
@@ -162,12 +170,14 @@ public:
BEAST_EXPECT(
static_cast<xxhasher::result_type>(hasher) ==
15296278154063476002ULL);
BEAST_EXPECT(xxhasher::test > 0);
}
void
testBigObjectWithOneUpdateWithSeed()
{
testcase("Big Object With One Update With Seed");
testcase("Big object with one update with seed");
xxhasher hasher{static_cast<std::uint32_t>(103)};
std::string objectToHash;
@@ -180,6 +190,40 @@ public:
BEAST_EXPECT(
static_cast<xxhasher::result_type>(hasher) ==
17285302196561698791ULL);
BEAST_EXPECT(xxhasher::test > 0);
}
void
testOperatorResultTypeDoesNotChangeInternalState()
{
testcase("Operator result type doesn't change the internal state");
{
xxhasher hasher;
std::string object{"Hello xxhash"};
hasher(object.data(), object.size());
auto xxhashResult1 = static_cast<xxhasher::result_type>(hasher);
auto xxhashResult2 = static_cast<xxhasher::result_type>(hasher);
BEAST_EXPECT(xxhashResult1 == xxhashResult2);
}
{
xxhasher hasher;
std::string object;
for (int i = 0; i < 100; i++)
{
object += "Hello, xxHash!";
}
hasher(object.data(), object.size());
auto xxhashResult1 = hasher.operator xxhasher::result_type();
auto xxhashResult2 = hasher.operator xxhasher::result_type();
BEAST_EXPECT(xxhashResult1 == xxhashResult2);
}
BEAST_EXPECT(xxhasher::test > 0);
}
void
@@ -194,6 +238,7 @@ public:
testBigObjectWithSmallAndBigUpdatesWithSeed();
testBigObjectWithOneUpdateWithoutSeed();
testBigObjectWithOneUpdateWithSeed();
testOperatorResultTypeDoesNotChangeInternalState();
}
};