Added test-ffi target, use it in CI (#9)

* Added test-ffi target, use it in CI

* Added clang-format config, fixed RETURN_STRING API mismatch

* Skip installing php and packages on the PHP docker images

* Removed al2 job that was never going to work, and compiler tests

* Fixed basic test for extension loading

* Cleaned up lib structure, fixed tests

* use test-ci target to conditionally test in GitHub

* Use v0.8.1 of builder
This commit is contained in:
Justin Boswell
2021-02-15 09:47:32 -08:00
committed by GitHub
parent 7b5ccfd55a
commit aee57a929d
18 changed files with 354 additions and 232 deletions
+58
View File
@@ -0,0 +1,58 @@
---
Language: Cpp
# BasedOnStyle: Mozilla
AlignAfterOpenBracket: AlwaysBreak
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Right
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
BinPackArguments: false
BinPackParameters: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: true
BreakStringLiterals: true
ColumnLimit: 120
ContinuationIndentWidth: 4
DerivePointerAlignment: false
IncludeBlocks: Preserve
IndentCaseLabels: true
IndentPPDirectives: AfterHash
IndentWidth: 4
IndentWrappedFunctionNames: true
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 100000
PointerAlignment: Right
ReflowComments: true
SortIncludes: true
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 4
UseTab: Never
...
+13 -23
View File
@@ -7,7 +7,7 @@ on:
- '!main' - '!main'
env: env:
BUILDER_VERSION: v0.7.7 BUILDER_VERSION: v0.8.1
BUILDER_SOURCE: releases BUILDER_SOURCE: releases
BUILDER_HOST: https://d19elf31gohf1l.cloudfront.net BUILDER_HOST: https://d19elf31gohf1l.cloudfront.net
PACKAGE_NAME: aws-crt-php PACKAGE_NAME: aws-crt-php
@@ -15,45 +15,35 @@ env:
RUN: ${{ github.run_id }}-${{ github.run_number }} RUN: ${{ github.run_id }}-${{ github.run_number }}
jobs: jobs:
al2: php7-linux-x64-ffi:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
# We can't use the `uses: docker://image` version yet, GitHub lacks authentication for actions -> packages - name: Build PHP 7.4 with ffi
- name: Build ${{ env.PACKAGE_NAME }} + consumers
run: | run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u awslabs --password-stdin echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u awslabs --password-stdin
export DOCKER_IMAGE=docker.pkg.github.com/awslabs/aws-crt-builder/aws-crt-al2-x64:${{ env.BUILDER_VERSION }} export DOCKER_IMAGE=docker.pkg.github.com/awslabs/aws-crt-builder/aws-crt-php7-linux-x64:${{ env.BUILDER_VERSION }}
docker pull $DOCKER_IMAGE docker pull $DOCKER_IMAGE
docker run --env GITHUB_REF --env LC_ALL=C.UTF-8 $DOCKER_IMAGE --version=${{env.BUILDER_VERSION}} build -p ${{ env.PACKAGE_NAME }} --spec=downstream docker run --env GITHUB_REF --env LC_ALL=C.UTF-8 --env TEST_FFI=1 $DOCKER_IMAGE --version=${{env.BUILDER_VERSION}} build -p ${{ env.PACKAGE_NAME }} --spec=downstream --skip-install
clang-compat: php7-linux-x64-ext:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
matrix:
version: [3, 6, 8, 9]
steps: steps:
# We can't use the `uses: docker://image` version yet, GitHub lacks authentication for actions -> packages - name: Build PHP 7.4 extension
- name: Build ${{ env.PACKAGE_NAME }}
run: | run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u awslabs --password-stdin echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u awslabs --password-stdin
export DOCKER_IMAGE=docker.pkg.github.com/awslabs/aws-crt-builder/aws-crt-${{ env.LINUX_BASE_IMAGE }}:${{ env.BUILDER_VERSION }} export DOCKER_IMAGE=docker.pkg.github.com/awslabs/aws-crt-builder/aws-crt-php7-linux-x64:${{ env.BUILDER_VERSION }}
docker pull $DOCKER_IMAGE docker pull $DOCKER_IMAGE
docker run --env GITHUB_REF --env LC_ALL=C.UTF-8 $DOCKER_IMAGE --version=${{env.BUILDER_VERSION}} build -p ${{ env.PACKAGE_NAME }} --spec=downstream --compiler=clang-${{ matrix.version }} docker run --env GITHUB_REF --env LC_ALL=C.UTF-8 $DOCKER_IMAGE --version=${{env.BUILDER_VERSION}} build -p ${{ env.PACKAGE_NAME }} --spec=downstream --skip-install
gcc-compat: php5-linux-x64-ext:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
matrix:
version: [4.8, 5, 6, 7, 8]
fail-fast: false
steps: steps:
# We can't use the `uses: docker://image` version yet, GitHub lacks authentication for actions -> packages - name: Build PHP 5.6 extension
- name: Build ${{ env.PACKAGE_NAME }}
run: | run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u awslabs --password-stdin echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u awslabs --password-stdin
export DOCKER_IMAGE=docker.pkg.github.com/awslabs/aws-crt-builder/aws-crt-${{ env.LINUX_BASE_IMAGE }}:${{ env.BUILDER_VERSION }} export DOCKER_IMAGE=docker.pkg.github.com/awslabs/aws-crt-builder/aws-crt-php5-linux-x64:${{ env.BUILDER_VERSION }}
docker pull $DOCKER_IMAGE docker pull $DOCKER_IMAGE
docker run --env GITHUB_REF --env LC_ALL=C.UTF-8 $DOCKER_IMAGE --version=${{env.BUILDER_VERSION}} build -p ${{ env.PACKAGE_NAME }} --spec=downstream --compiler=gcc-${{ matrix.version }} docker run --env GITHUB_REF --env LC_ALL=C.UTF-8 $DOCKER_IMAGE --version=${{env.BUILDER_VERSION}} build -p ${{ env.PACKAGE_NAME }} --spec=downstream --skip-install
# linux-arm: # linux-arm:
# name: ARM (${{ matrix.arch }}) # name: ARM (${{ matrix.arch }})
+11
View File
@@ -50,3 +50,14 @@ $(INSTALL_DIR)/lib/api.h: crt/aws-crt-ffi/src/api.h
# Force the crt object target to depend on the FFI library # Force the crt object target to depend on the FFI library
src/crt.lo: $(INSTALL_DIR)/lib/libaws-crt-ffi.so src/crt.lo: $(INSTALL_DIR)/lib/libaws-crt-ffi.so
ifeq ($(TEST_FFI),1)
test-ci: test-ffi
else
test-ci: test
endif
# Test the FFI interface
test-ffi: $(INSTALL_DIR)/lib/libaws-crt-ffi.so
composer update
composer run test
+1 -1
View File
@@ -32,6 +32,6 @@
"NO_INTERACTION": "1" "NO_INTERACTION": "1"
}, },
"test_steps": [ "test_steps": [
["make", "test"] ["make", "test-ci"]
] ]
} }
+11 -7
View File
@@ -1,9 +1,8 @@
{ {
"name": "aws/awscrt", "name": "aws/crt",
"description": "AWS Common Runtime for PHP", "description": "AWS Common Runtime for PHP",
"type": "library", "type": "library",
"require": { "require": {
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^5" "phpunit/phpunit": "^5"
@@ -11,16 +10,21 @@
"conflict": { "conflict": {
"phpunit/php-timer": ">=2" "phpunit/php-timer": ">=2"
}, },
"autoload-dev": { "autoload": {
"classmap": [ "classmap": [
"lib/" "lib/"
],
"psr-4": {
"AWS\\": "lib/AWS"
}
},
"autoload-dev": {
"classmap": [
"lib/tests/"
] ]
}, },
"autoload": {
"files": ["lib/preload.php"]
},
"scripts": { "scripts": {
"test": "phpunit --bootstrap lib/lib.php" "test": "phpunit lib/tests"
}, },
"license": "Apache-2.0", "license": "Apache-2.0",
"authors": [ "authors": [
Generated
+169 -101
View File
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "4682df025d6293ec7ee1ee543ab3a541", "content-hash": "701910d2701734e6469f8b2ce89efcd1",
"packages": [], "packages": [],
"packages-dev": [ "packages-dev": [
{ {
@@ -361,40 +361,40 @@
}, },
{ {
"name": "phpunit/php-code-coverage", "name": "phpunit/php-code-coverage",
"version": "3.3.3", "version": "4.0.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "44cd8e3930e431658d1a5de7d282d5cb37837fd5" "reference": "ef7b2f56815df854e66ceaee8ebe9393ae36a40d"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/44cd8e3930e431658d1a5de7d282d5cb37837fd5", "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ef7b2f56815df854e66ceaee8ebe9393ae36a40d",
"reference": "44cd8e3930e431658d1a5de7d282d5cb37837fd5", "reference": "ef7b2f56815df854e66ceaee8ebe9393ae36a40d",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"ext-dom": "*",
"ext-xmlwriter": "*",
"php": "^5.6 || ^7.0", "php": "^5.6 || ^7.0",
"phpunit/php-file-iterator": "~1.3", "phpunit/php-file-iterator": "^1.3",
"phpunit/php-text-template": "~1.2", "phpunit/php-text-template": "^1.2",
"phpunit/php-token-stream": "^1.4.2", "phpunit/php-token-stream": "^1.4.2 || ^2.0",
"sebastian/code-unit-reverse-lookup": "~1.0", "sebastian/code-unit-reverse-lookup": "^1.0",
"sebastian/environment": "^1.3.2", "sebastian/environment": "^1.3.2 || ^2.0",
"sebastian/version": "~1.0|~2.0" "sebastian/version": "^1.0 || ^2.0"
}, },
"require-dev": { "require-dev": {
"ext-xdebug": ">=2.1.4", "ext-xdebug": "^2.1.4",
"phpunit/phpunit": "~5" "phpunit/phpunit": "^5.7"
}, },
"suggest": { "suggest": {
"ext-dom": "*", "ext-xdebug": "^2.5.1"
"ext-xdebug": ">=2.4.0",
"ext-xmlwriter": "*"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "3.3.x-dev" "dev-master": "4.0.x-dev"
} }
}, },
"autoload": { "autoload": {
@@ -423,9 +423,9 @@
"support": { "support": {
"irc": "irc://irc.freenode.net/phpunit", "irc": "irc://irc.freenode.net/phpunit",
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/3.3" "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/4.0"
}, },
"time": "2016-05-27T16:24:29+00:00" "time": "2017-04-02T07:44:40+00:00"
}, },
{ {
"name": "phpunit/php-file-iterator", "name": "phpunit/php-file-iterator",
@@ -579,29 +579,29 @@
}, },
{ {
"name": "phpunit/php-token-stream", "name": "phpunit/php-token-stream",
"version": "1.4.12", "version": "2.0.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/php-token-stream.git", "url": "https://github.com/sebastianbergmann/php-token-stream.git",
"reference": "1ce90ba27c42e4e44e6d8458241466380b51fa16" "reference": "791198a2c6254db10131eecfe8c06670700904db"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/1ce90ba27c42e4e44e6d8458241466380b51fa16", "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/791198a2c6254db10131eecfe8c06670700904db",
"reference": "1ce90ba27c42e4e44e6d8458241466380b51fa16", "reference": "791198a2c6254db10131eecfe8c06670700904db",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"ext-tokenizer": "*", "ext-tokenizer": "*",
"php": ">=5.3.3" "php": "^7.0"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "~4.2" "phpunit/phpunit": "^6.2.4"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "1.4-dev" "dev-master": "2.0-dev"
} }
}, },
"autoload": { "autoload": {
@@ -626,49 +626,57 @@
], ],
"support": { "support": {
"issues": "https://github.com/sebastianbergmann/php-token-stream/issues", "issues": "https://github.com/sebastianbergmann/php-token-stream/issues",
"source": "https://github.com/sebastianbergmann/php-token-stream/tree/1.4" "source": "https://github.com/sebastianbergmann/php-token-stream/tree/master"
}, },
"abandoned": true, "abandoned": true,
"time": "2017-12-04T08:55:13+00:00" "time": "2017-11-27T05:48:46+00:00"
}, },
{ {
"name": "phpunit/phpunit", "name": "phpunit/phpunit",
"version": "5.0.0", "version": "5.7.27",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git", "url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "49f1c93ee37d10ffba6ce287d67110547b40b1d7" "reference": "b7803aeca3ccb99ad0a506fa80b64cd6a56bbc0c"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/49f1c93ee37d10ffba6ce287d67110547b40b1d7", "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/b7803aeca3ccb99ad0a506fa80b64cd6a56bbc0c",
"reference": "49f1c93ee37d10ffba6ce287d67110547b40b1d7", "reference": "b7803aeca3ccb99ad0a506fa80b64cd6a56bbc0c",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"ext-dom": "*", "ext-dom": "*",
"ext-json": "*", "ext-json": "*",
"ext-pcre": "*", "ext-libxml": "*",
"ext-reflection": "*", "ext-mbstring": "*",
"ext-spl": "*", "ext-xml": "*",
"myclabs/deep-copy": "~1.3", "myclabs/deep-copy": "~1.3",
"php": ">=5.6", "php": "^5.6 || ^7.0",
"phpspec/prophecy": "^1.3.1", "phpspec/prophecy": "^1.6.2",
"phpunit/php-code-coverage": "~3.0", "phpunit/php-code-coverage": "^4.0.4",
"phpunit/php-file-iterator": "~1.4", "phpunit/php-file-iterator": "~1.4",
"phpunit/php-text-template": "~1.2", "phpunit/php-text-template": "~1.2",
"phpunit/php-timer": ">=1.0.6", "phpunit/php-timer": "^1.0.6",
"phpunit/phpunit-mock-objects": ">=3.0", "phpunit/phpunit-mock-objects": "^3.2",
"sebastian/comparator": "~1.1", "sebastian/comparator": "^1.2.4",
"sebastian/diff": "~1.2", "sebastian/diff": "^1.4.3",
"sebastian/environment": "~1.3", "sebastian/environment": "^1.3.4 || ^2.0",
"sebastian/exporter": "~1.2", "sebastian/exporter": "~2.0",
"sebastian/global-state": "~1.0", "sebastian/global-state": "^1.1",
"sebastian/object-enumerator": "~2.0",
"sebastian/resource-operations": "~1.0", "sebastian/resource-operations": "~1.0",
"sebastian/version": "~1.0", "sebastian/version": "^1.0.6|^2.0.1",
"symfony/yaml": "~2.1|~3.0" "symfony/yaml": "~2.1|~3.0|~4.0"
},
"conflict": {
"phpdocumentor/reflection-docblock": "3.0.2"
},
"require-dev": {
"ext-pdo": "*"
}, },
"suggest": { "suggest": {
"ext-xdebug": "*",
"phpunit/php-invoker": "~1.1" "phpunit/php-invoker": "~1.1"
}, },
"bin": [ "bin": [
@@ -677,7 +685,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "5.0.x-dev" "dev-master": "5.7.x-dev"
} }
}, },
"autoload": { "autoload": {
@@ -704,34 +712,36 @@
"xunit" "xunit"
], ],
"support": { "support": {
"irc": "irc://irc.freenode.net/phpunit",
"issues": "https://github.com/sebastianbergmann/phpunit/issues", "issues": "https://github.com/sebastianbergmann/phpunit/issues",
"source": "https://github.com/sebastianbergmann/phpunit/tree/5.0.0" "source": "https://github.com/sebastianbergmann/phpunit/tree/5.7.27"
}, },
"time": "2015-10-02T03:16:10+00:00" "time": "2018-02-01T05:50:59+00:00"
}, },
{ {
"name": "phpunit/phpunit-mock-objects", "name": "phpunit/phpunit-mock-objects",
"version": "3.1.3", "version": "3.4.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
"reference": "151c96874bff6fe61a25039df60e776613a61489" "reference": "a23b761686d50a560cc56233b9ecf49597cc9118"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/151c96874bff6fe61a25039df60e776613a61489", "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/a23b761686d50a560cc56233b9ecf49597cc9118",
"reference": "151c96874bff6fe61a25039df60e776613a61489", "reference": "a23b761686d50a560cc56233b9ecf49597cc9118",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"doctrine/instantiator": "^1.0.2", "doctrine/instantiator": "^1.0.2",
"php": ">=5.6", "php": "^5.6 || ^7.0",
"phpunit/php-text-template": "~1.2", "phpunit/php-text-template": "^1.2",
"sebastian/exporter": "~1.2" "sebastian/exporter": "^1.2 || ^2.0"
},
"conflict": {
"phpunit/phpunit": "<5.4.0"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "~5" "phpunit/phpunit": "^5.4"
}, },
"suggest": { "suggest": {
"ext-soap": "*" "ext-soap": "*"
@@ -739,7 +749,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "3.1.x-dev" "dev-master": "3.2.x-dev"
} }
}, },
"autoload": { "autoload": {
@@ -767,10 +777,10 @@
"support": { "support": {
"irc": "irc://irc.freenode.net/phpunit", "irc": "irc://irc.freenode.net/phpunit",
"issues": "https://github.com/sebastianbergmann/phpunit-mock-objects/issues", "issues": "https://github.com/sebastianbergmann/phpunit-mock-objects/issues",
"source": "https://github.com/sebastianbergmann/phpunit-mock-objects/tree/3.1" "source": "https://github.com/sebastianbergmann/phpunit-mock-objects/tree/3.4"
}, },
"abandoned": true, "abandoned": true,
"time": "2016-04-20T14:39:26+00:00" "time": "2017-06-30T09:13:00+00:00"
}, },
{ {
"name": "sebastian/code-unit-reverse-lookup", "name": "sebastian/code-unit-reverse-lookup",
@@ -953,28 +963,28 @@
}, },
{ {
"name": "sebastian/environment", "name": "sebastian/environment",
"version": "1.3.8", "version": "2.0.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/environment.git", "url": "https://github.com/sebastianbergmann/environment.git",
"reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea" "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/be2c607e43ce4c89ecd60e75c6a85c126e754aea", "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/5795ffe5dc5b02460c3e34222fee8cbe245d8fac",
"reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea", "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": "^5.3.3 || ^7.0" "php": "^5.6 || ^7.0"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^4.8 || ^5.0" "phpunit/phpunit": "^5.0"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "1.3.x-dev" "dev-master": "2.0.x-dev"
} }
}, },
"autoload": { "autoload": {
@@ -1001,27 +1011,27 @@
], ],
"support": { "support": {
"issues": "https://github.com/sebastianbergmann/environment/issues", "issues": "https://github.com/sebastianbergmann/environment/issues",
"source": "https://github.com/sebastianbergmann/environment/tree/1.3" "source": "https://github.com/sebastianbergmann/environment/tree/master"
}, },
"time": "2016-08-18T05:49:44+00:00" "time": "2016-11-26T07:53:53+00:00"
}, },
{ {
"name": "sebastian/exporter", "name": "sebastian/exporter",
"version": "1.2.2", "version": "2.0.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/exporter.git", "url": "https://github.com/sebastianbergmann/exporter.git",
"reference": "42c4c2eec485ee3e159ec9884f95b431287edde4" "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/42c4c2eec485ee3e159ec9884f95b431287edde4", "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4",
"reference": "42c4c2eec485ee3e159ec9884f95b431287edde4", "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.3.3", "php": ">=5.3.3",
"sebastian/recursion-context": "~1.0" "sebastian/recursion-context": "~2.0"
}, },
"require-dev": { "require-dev": {
"ext-mbstring": "*", "ext-mbstring": "*",
@@ -1030,7 +1040,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "1.3.x-dev" "dev-master": "2.0.x-dev"
} }
}, },
"autoload": { "autoload": {
@@ -1074,7 +1084,7 @@
"issues": "https://github.com/sebastianbergmann/exporter/issues", "issues": "https://github.com/sebastianbergmann/exporter/issues",
"source": "https://github.com/sebastianbergmann/exporter/tree/master" "source": "https://github.com/sebastianbergmann/exporter/tree/master"
}, },
"time": "2016-06-17T09:04:28+00:00" "time": "2016-11-19T08:54:04+00:00"
}, },
{ {
"name": "sebastian/global-state", "name": "sebastian/global-state",
@@ -1132,17 +1142,67 @@
"time": "2015-10-12T03:26:01+00:00" "time": "2015-10-12T03:26:01+00:00"
}, },
{ {
"name": "sebastian/recursion-context", "name": "sebastian/object-enumerator",
"version": "1.0.5", "version": "2.0.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/recursion-context.git", "url": "https://github.com/sebastianbergmann/object-enumerator.git",
"reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7" "reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/b19cc3298482a335a95f3016d2f8a6950f0fbcd7", "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/1311872ac850040a79c3c058bea3e22d0f09cbb7",
"reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7", "reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7",
"shasum": ""
},
"require": {
"php": ">=5.6",
"sebastian/recursion-context": "~2.0"
},
"require-dev": {
"phpunit/phpunit": "~5"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "[email protected]"
}
],
"description": "Traverses array structures and object graphs to enumerate all referenced objects",
"homepage": "https://github.com/sebastianbergmann/object-enumerator/",
"support": {
"issues": "https://github.com/sebastianbergmann/object-enumerator/issues",
"source": "https://github.com/sebastianbergmann/object-enumerator/tree/master"
},
"time": "2017-02-18T15:18:39+00:00"
},
{
"name": "sebastian/recursion-context",
"version": "2.0.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/recursion-context.git",
"reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/2c3ba150cbec723aa057506e73a8d33bdb286c9a",
"reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -1154,7 +1214,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "1.0.x-dev" "dev-master": "2.0.x-dev"
} }
}, },
"autoload": { "autoload": {
@@ -1186,7 +1246,7 @@
"issues": "https://github.com/sebastianbergmann/recursion-context/issues", "issues": "https://github.com/sebastianbergmann/recursion-context/issues",
"source": "https://github.com/sebastianbergmann/recursion-context/tree/master" "source": "https://github.com/sebastianbergmann/recursion-context/tree/master"
}, },
"time": "2016-10-03T07:41:43+00:00" "time": "2016-11-19T07:33:16+00:00"
}, },
{ {
"name": "sebastian/resource-operations", "name": "sebastian/resource-operations",
@@ -1236,19 +1296,27 @@
}, },
{ {
"name": "sebastian/version", "name": "sebastian/version",
"version": "1.0.6", "version": "2.0.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/version.git", "url": "https://github.com/sebastianbergmann/version.git",
"reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6" "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019",
"reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019",
"shasum": "" "shasum": ""
}, },
"require": {
"php": ">=5.6"
},
"type": "library", "type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
}
},
"autoload": { "autoload": {
"classmap": [ "classmap": [
"src/" "src/"
@@ -1269,9 +1337,9 @@
"homepage": "https://github.com/sebastianbergmann/version", "homepage": "https://github.com/sebastianbergmann/version",
"support": { "support": {
"issues": "https://github.com/sebastianbergmann/version/issues", "issues": "https://github.com/sebastianbergmann/version/issues",
"source": "https://github.com/sebastianbergmann/version/tree/1.0.6" "source": "https://github.com/sebastianbergmann/version/tree/master"
}, },
"time": "2015-06-21T13:59:46+00:00" "time": "2016-10-03T07:35:21+00:00"
}, },
{ {
"name": "symfony/polyfill-ctype", "name": "symfony/polyfill-ctype",
@@ -1354,27 +1422,27 @@
}, },
{ {
"name": "symfony/yaml", "name": "symfony/yaml",
"version": "v3.4.47", "version": "v4.4.19",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/yaml.git", "url": "https://github.com/symfony/yaml.git",
"reference": "88289caa3c166321883f67fe5130188ebbb47094" "reference": "17ed9f14c1aa05b1a5cf2e2c5ef2d0be28058ef9"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/yaml/zipball/88289caa3c166321883f67fe5130188ebbb47094", "url": "https://api.github.com/repos/symfony/yaml/zipball/17ed9f14c1aa05b1a5cf2e2c5ef2d0be28058ef9",
"reference": "88289caa3c166321883f67fe5130188ebbb47094", "reference": "17ed9f14c1aa05b1a5cf2e2c5ef2d0be28058ef9",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": "^5.5.9|>=7.0.8", "php": ">=7.1.3",
"symfony/polyfill-ctype": "~1.8" "symfony/polyfill-ctype": "~1.8"
}, },
"conflict": { "conflict": {
"symfony/console": "<3.4" "symfony/console": "<3.4"
}, },
"require-dev": { "require-dev": {
"symfony/console": "~3.4|~4.0" "symfony/console": "^3.4|^4.0|^5.0"
}, },
"suggest": { "suggest": {
"symfony/console": "For validating YAML files using the lint command" "symfony/console": "For validating YAML files using the lint command"
@@ -1402,10 +1470,10 @@
"homepage": "https://symfony.com/contributors" "homepage": "https://symfony.com/contributors"
} }
], ],
"description": "Symfony Yaml Component", "description": "Loads and dumps YAML files",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/yaml/tree/v3.4.47" "source": "https://github.com/symfony/yaml/tree/v4.4.19"
}, },
"funding": [ "funding": [
{ {
@@ -1421,7 +1489,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2020-10-24T10:57:07+00:00" "time": "2021-01-27T09:09:26+00:00"
}, },
{ {
"name": "webmozart/assert", "name": "webmozart/assert",
+3 -39
View File
@@ -12,7 +12,7 @@ final class CRT {
function __construct() { function __construct() {
if (is_null(self::$ffi)) { if (is_null(self::$ffi)) {
try { try {
self::$ffi = FFI::cdef(file_get_contents(__DIR__ . "/api.h"), __DIR__ . "/libaws-crt-ffi.so"); self::$ffi = FFI::cdef(file_get_contents(__DIR__ . "/../api.h"), __DIR__ . "/../libaws-crt-ffi.so");
self::init(); self::init();
} catch (Exception $e) { } catch (Exception $e) {
echo 'Exception while initializing CRT via FFI: ', $e->getMessage(), "\n"; echo 'Exception while initializing CRT via FFI: ', $e->getMessage(), "\n";
@@ -59,47 +59,11 @@ final class CRT {
return self::$ffi->aws_crt_error_name((int) $error); return self::$ffi->aws_crt_error_name((int) $error);
} }
function event_loop_group_new($options) { function event_loop_group_new($num_threads) {
return self::$ffi->aws_crt_event_loop_group_new($options->num_threads); return self::$ffi->aws_crt_event_loop_group_new($num_threads);
} }
function event_loop_group_release($elg) { function event_loop_group_release($elg) {
return self::$ffi->aws_crt_event_loop_group_release($elg); return self::$ffi->aws_crt_event_loop_group_release($elg);
} }
} }
/**
* Base class for all native resources, tracks all outstanding resources
* and provides basic leak checking
*/
abstract class NativeResource {
protected static $crt = null;
protected static $resources = [];
protected $native = null;
function __construct() {
if (is_null(self::$crt)) {
try {
self::$crt = new CRT();
} catch (Exception $e) {
echo 'Exception while loading CRT: ', $e->getMessage(), "\n";
}
}
self::$resources[spl_object_hash($this)] = 1;
}
protected function acquire($handle) {
$this->native = $handle;
}
protected function release() {
$this->native = null;
}
function __destruct() {
// Should have been destroyed and released by derived resource
assert($this->native == null);
unset(self::$resources[spl_object_hash($this)]);
}
}
@@ -1,22 +1,26 @@
<?php <?php
require_once('crt.php');
final class EventLoopGroupOptions {
/**
* @var int $num_threads - Number of worker threads in the EventLoopGroup. Defaults to 0/1 per logical core.
*/
public $num_threads = 0;
}
/** /**
* Represents 1 or more event loops (1 per thread) for doing I/O and background tasks. * Represents 1 or more event loops (1 per thread) for doing I/O and background tasks.
* Typically, every application has one EventLoopGroup. * Typically, every application has one EventLoopGroup.
*
* @param array options:
* - int num_threads - Number of worker threads in the EventLoopGroup. Defaults to 0/1 per logical core.
*/ */
final class EventLoopGroup extends NativeResource { final class EventLoopGroup extends NativeResource {
function __construct($options) {
static function defaults() {
return array(
'num_threads' => 0,
);
}
function __construct(array $options = array()) {
parent::__construct(); parent::__construct();
$this->acquire(self::$crt->event_loop_group_new($options->num_threads)); if (count($options) == 0) {
$options = self::defaults();
}
$this->acquire(self::$crt->event_loop_group_new($options['num_threads']));
} }
function __destruct() { function __destruct() {
+37
View File
@@ -0,0 +1,37 @@
<?php
/**
* Base class for all native resources, tracks all outstanding resources
* and provides basic leak checking
*/
abstract class NativeResource {
protected static $crt = null;
protected static $resources = [];
protected $native = null;
function __construct() {
if (is_null(self::$crt)) {
try {
self::$crt = new CRT();
} catch (Exception $e) {
echo 'Exception while loading CRT: ', $e->getMessage(), "\n";
}
}
self::$resources[spl_object_hash($this)] = 1;
}
protected function acquire($handle) {
$this->native = $handle;
}
protected function release() {
$this->native = null;
}
function __destruct() {
// Should have been destroyed and released by derived resource
assert($this->native == null);
unset(self::$resources[spl_object_hash($this)]);
}
}
-7
View File
@@ -1,7 +0,0 @@
<?php
// Entry point to the CRT library. This file should be preloaded.
// Import all of the library modules
require_once('crt.php');
require_once('io.php');
-7
View File
@@ -1,7 +0,0 @@
<?php
// php.ini
// ffi.enable=preload
// opcache.preload=preload.php
if (function_exists("opcache_compile_file")) {
opcache_compile_file(__DIR__ . "/lib.php");
}
-7
View File
@@ -1,7 +0,0 @@
<?php
require_once('crt.php');
$crt = new CRT();
$crt->init();
var_dump($crt->error_name(0));
$crt->clean_up();
-2
View File
@@ -1,7 +1,5 @@
<?php <?php
require_once('tests.inc');
final class ErrorTest extends PHPUnit_Framework_TestCase { final class ErrorTest extends PHPUnit_Framework_TestCase {
private static $crt = null; private static $crt = null;
public static function setUpBeforeClass() { public static function setUpBeforeClass() {
+3 -5
View File
@@ -1,17 +1,15 @@
<?php <?php
require_once('tests.inc');
final class EventLoopGroupTest extends PHPUnit_Framework_TestCase { final class EventLoopGroupTest extends PHPUnit_Framework_TestCase {
public function testLifetime() { public function testLifetime() {
$elg = new EventLoopGroup(new EventLoopGroupOptions()); $elg = new EventLoopGroup();
$elg = null; $elg = null;
} }
public function testConstructionWithOptions() { public function testConstructionWithOptions() {
$options = new EventLoopGroupOptions(); $options = EventLoopGroup::defaults();
$options->num_threads = 1; $options['num_threads'] = 1;
$elg = new EventLoopGroup($options); $elg = new EventLoopGroup($options);
$elg = null; $elg = null;
} }
-9
View File
@@ -1,9 +0,0 @@
<?php
// Ensure any version of PHPUnit works, since phpunit5 is the last one that
// works with PHP5.6
if (!class_exists('PHPUnit_Framework_TestCase') &&
class_exists('\\PHPUnit\\Framework\\TestCase')) {
abstract class PHPUnit_Framework_TestCase extends \PHPUnit\Framework\TestCase {
}
}
+16 -10
View File
@@ -9,34 +9,40 @@
ZEND_DECLARE_MODULE_GLOBALS(awscrt); ZEND_DECLARE_MODULE_GLOBALS(awscrt);
PHP_INI_BEGIN() PHP_INI_BEGIN()
STD_PHP_INI_ENTRY("awscrt.log_level", "", PHP_INI_ALL, OnUpdateLongGEZero, STD_PHP_INI_ENTRY(
log_level, zend_awscrt_globals, awscrt_globals) "awscrt.log_level",
"",
PHP_INI_ALL,
OnUpdateLongGEZero,
log_level,
zend_awscrt_globals,
awscrt_globals)
PHP_INI_END() PHP_INI_END()
static PHP_MINIT_FUNCTION(awscrt) { static PHP_MINIT_FUNCTION(awscrt) {
REGISTER_INI_ENTRIES(); REGISTER_INI_ENTRIES();
return SUCCESS; return SUCCESS;
} }
static PHP_MSHUTDOWN_FUNCTION(awscrt) { static PHP_MSHUTDOWN_FUNCTION(awscrt) {
UNREGISTER_INI_ENTRIES(); UNREGISTER_INI_ENTRIES();
return SUCCESS; return SUCCESS;
} }
static PHP_GINIT_FUNCTION(awscrt) { static PHP_GINIT_FUNCTION(awscrt) {
#if defined(COMPILE_DL_ASTKIT) && defined(ZTS) #if defined(COMPILE_DL_ASTKIT) && defined(ZTS)
ZEND_TSRMLS_CACHE_UPDATE(); ZEND_TSRMLS_CACHE_UPDATE();
#endif #endif
awscrt_globals->log_level = 0; awscrt_globals->log_level = 0;
} }
ZEND_BEGIN_ARG_INFO(awscrt_version_arginfo, 0) ZEND_BEGIN_ARG_INFO(awscrt_version_arginfo, 0)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
PHP_FUNCTION(awscrt_version) { PHP_FUNCTION(awscrt_version) {
static const char *version = "1.0.0-dev"; static const char *version = "1.0.0-dev";
RETURN_STRING(version, 0); AWS_RETURN_STRING(version);
} }
/* clang-format off */ /* clang-format off */
const zend_function_entry awscrt_functions[] = { const zend_function_entry awscrt_functions[] = {
+16 -1
View File
@@ -8,11 +8,19 @@
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" # include "config.h"
#endif #endif
#include "php.h" #include "php.h"
#include "Zend/zend_extensions.h" /* for ZEND_EXTENSION_API_NO */
#if ZEND_EXTENSION_API_NO < 220131226
# error "PHP >= 5.6 is required"
#endif
#define AWS_PHP_AT_LEAST_7 defined(ZEND_EXTENSION_API_NO_7_0_X) || (ZEND_EXTENSION_API_NO >= 320151012)
ZEND_BEGIN_MODULE_GLOBALS(awscrt) ZEND_BEGIN_MODULE_GLOBALS(awscrt)
long log_level; long log_level;
ZEND_END_MODULE_GLOBALS(awscrt) ZEND_END_MODULE_GLOBALS(awscrt)
@@ -21,4 +29,11 @@ ZEND_EXTERN_MODULE_GLOBALS(awscrt)
#define AWSCRT_GLOBAL(v) ZEND_MODULE_GLOBALS_ACCESSOR(awscrt, v) #define AWSCRT_GLOBAL(v) ZEND_MODULE_GLOBALS_ACCESSOR(awscrt, v)
/* PHP 7 removed the string duplicate parameter */
#if AWS_PHP_AT_LEAST_7
# define AWS_RETURN_STRING(s) RETURN_STRING(s)
#else
# define AWS_RETURN_STRING(s) RETURN_STRING(s, 1)
#endif
#endif /* PHP_AWS_CRT_H */ #endif /* PHP_AWS_CRT_H */
+1 -2
View File
@@ -1,4 +1,4 @@
--TEST-- --TEST--
Version: Simple function call Version: Simple function call
--SKIPIF-- --SKIPIF--
<?php <?php
@@ -10,6 +10,5 @@ require_once(dirname(__FILE__) . '/common.inc');
echo awscrt_version(); echo awscrt_version();
?> ?>
===DONE===
--EXPECT-- --EXPECT--
1.0.0-dev 1.0.0-dev