Skip to content

Commit

Permalink
php: Verify if extensions are correctly built
Browse files Browse the repository at this point in the history
  • Loading branch information
ondj committed Feb 5, 2024
1 parent c21c8b8 commit d6b5c15
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
33 changes: 33 additions & 0 deletions bin/misp_verify.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/php
<?php
function testBrotli()
{
$stringToCompress = "Ahoj světe";
$decoded = brotli_uncompress(brotli_compress($stringToCompress));
assert($stringToCompress == $decoded);
}

function testZstd()
{
$stringToCompress = "Ahoj světe";
$decoded = zstd_uncompress(zstd_compress($stringToCompress));
assert($stringToCompress == $decoded);
}

function testIgbinary()
{
$dataToSerialize = ["Ahoj" => "světe"];
$deserialized = igbinary_unserialize(igbinary_serialize($dataToSerialize));
assert($dataToSerialize == $deserialized);
}

function testSsdeep()
{
$hash = ssdeep_fuzzy_hash("ahoj světe");
assert(is_string($hash));
}

testBrotli();
testZstd();
testIgbinary();
testSsdeep();
3 changes: 3 additions & 0 deletions bin/misp_verify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ set -o xtrace
# Check if PHP is properly configured
php -v

# Check if PHP extensions are properly built
misp_verify.php

# Build test
# Temporary disable for aarch64, because LIEF is broken in arm
if [[ "$(uname -m)" != "aarch64" ]]; then
Expand Down

0 comments on commit d6b5c15

Please sign in to comment.