-
Notifications
You must be signed in to change notification settings - Fork 15.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updated and simplified PHP testing structure #8558
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
7f9c4ae
Simplified PHP testing setup.
haberman 2d679de
More improvements to PHP testing.
haberman c058d00
Added assertions to verify that the C test doesn't use PHP sources.
haberman 9083c3d
Updated tests.sh for the new PHP testing commands.
haberman f5ac4d1
Removed obsolete rules from tests.sh.
haberman c4720b4
Fixed generate_test_protos.sh for when tmp does not exist.
haberman 82154df
Added php8.0_all again which is still used.
haberman ba9539c
Added missing file to Makefile.am.
haberman da2d7f3
Re-added php_all_32 rule which is also still used.
haberman f9e5b7c
Updated testing commands for macOS and download composer.
haberman dc2d2b0
Use /usr/local/bin on mac instead of /usr/bin, since the latter is no…
haberman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
cd `dirname $0` | ||
|
||
if [[ -d tmp && -z $(find tests/proto ../src/protoc -newer tmp) ]]; then | ||
# Generated protos are already present and up to date, so we can skip protoc. | ||
# | ||
# Protoc is very fast, but sometimes it is not available (like if we haven't | ||
# built it in Docker). Skipping it helps us proceed in this case. | ||
echo "Test protos are up-to-date, skipping protoc." | ||
exit 0 | ||
fi | ||
|
||
rm -rf tmp | ||
mkdir -p tmp | ||
|
||
find tests/proto -type f -name "*.proto"| xargs ../src/protoc --php_out=tmp -I../src -Itests | ||
|
||
if [ "$1" = "--aggregate_metadata" ]; then | ||
# Overwrite some of the files to use aggregation. | ||
AGGREGATED_FILES="tests/proto/test.proto tests/proto/test_include.proto tests/proto/test_import_descriptor_proto.proto" | ||
../src/protoc --php_out=aggregate_metadata=foo#bar:tmp -I../src -Itests $AGGREGATED_FILES | ||
fi | ||
|
||
echo "Generated test protos from tests/proto -> tmp" |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,26 @@ | ||
#!/bin/bash | ||
|
||
set -ex | ||
set -e | ||
|
||
cd $(dirname $0) | ||
|
||
../prepare_c_extension.sh | ||
pushd ../ext/google/protobuf | ||
phpize --clean | ||
rm -f configure.in configure.ac | ||
phpize | ||
if [ "$1" = "--release" ]; then | ||
./configure --with-php-config=$(which php-config) | ||
else | ||
# To get debugging symbols in PHP itself, build PHP with: | ||
# $ ./configure --enable-debug CFLAGS='-g -O0' | ||
./configure --with-php-config=$(which php-config) CFLAGS="-g -O0 -Wall" | ||
pushd ../ext/google/protobuf > /dev/null | ||
|
||
CONFIGURE_OPTIONS=("./configure" "--with-php-config=$(which php-config)") | ||
|
||
if [ "$1" != "--release" ]; then | ||
CONFIGURE_OPTIONS+=("CFLAGS=-g -O0 -Wall") | ||
fi | ||
|
||
# If the PHP interpreter we are building against or the arguments | ||
# have changed, we must regenerated the Makefile. | ||
if [[ ! -f Makefile ]] || [[ "$(grep ' \$ ./configure' config.log)" != " $ ${CONFIGURE_OPTIONS[@]}" ]]; then | ||
phpize --clean | ||
rm -f configure.in configure.ac | ||
phpize | ||
"${CONFIGURE_OPTIONS[@]}" | ||
fi | ||
|
||
make | ||
popd | ||
popd > /dev/null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
// We have to test this because the command-line argument will fail silently | ||
// if the extension could not be loaded: | ||
// php -dextension=ext/google/protobuf/modules/protouf.so | ||
if (!extension_loaded("protobuf")) { | ||
throw new Exception("Protobuf extension not loaded"); | ||
} | ||
|
||
spl_autoload_register(function($class) { | ||
if (strpos($class, "Google\\Protobuf") === 0) { | ||
throw new Exception("When using the C extension, we should not load runtime class: " . $class); | ||
} | ||
}, true, true); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well known types are bundled in c extension?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, they are as of #7944