Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
*.lo
*.o
.deps
.libs
Dockerfile.tmp
Makefile
Makefile.fragments
Makefile.global
Makefile.objects
acinclude.m4
aclocal.m4
autom4te.cache/*
build/*
config.guess
config.h
config.h.in
*.log
config.nice
config.status
config.sub
configure
configure.in
configure.ac
*~
install-sh
libtool
ltmain.sh
missing
mkinstalldirs
modules/*
v8js.la
v8js-*.tgz
run-tests.php
.*.sw[poq]

tests/*.diff
tests/*.exp
tests/*.out
tests/*.php
tests/*.sh
tests/*.mem

.vagrant
tmp-php.ini

coverage_report/**
22 changes: 22 additions & 0 deletions Dockerfile.jenkins
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
ARG V8VER
FROM stesie/libv8-${V8VER}:latest

ARG PHPVER

ENV DEBIAN_FRONTEND=noninteractive
ENV LC_ALL=C.UTF-8
ENV NO_INTERACTION=1
ENV REPORT_EXIT_STATUS=1

RUN apt-get update -q
RUN apt-get install -y wget autoconf build-essential libreadline-dev pkg-config

RUN wget https://www.php.net/distributions/php-${PHPVER}.tar.gz && \
tar xzf php-${PHPVER}.tar.gz
ADD . /php-${PHPVER}/ext/v8js
WORKDIR /php-${PHPVER}

RUN ./buildconf --force
RUN ./configure --disable-all --with-readline --enable-cli --enable-json --enable-maintainer-zts --with-v8js=/opt/libv8-$V8VER/ CFLAGS="-fsanitize=address -g -O0" CXXFLAGS="-fsanitize=address -g -O0"
RUN sed -e "s/^EXTRA_LIBS.*/& -lv8_libplatform -ldl/" -i Makefile
RUN make -j5
34 changes: 34 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
pipeline {
agent none
stages {
stage('BuildAndTest') {
matrix {
agent any
axes {
axis {
name 'PHPVER'
values '7.3.16', '7.4.4'
}
axis {
name 'V8VER'
values '7.9'
}
}
stages {
stage('Build') {
steps {
echo "Building w/ V8 ${V8VER}, PHP ${PHPVER} as Docker image ${BUILD_TAG}-${V8VER}-${PHPVER}"
sh "docker build -f Dockerfile.jenkins --build-arg V8VER=${V8VER} --build-arg PHPVER=${PHPVER} -t ${BUILD_TAG}-${V8VER}-${PHPVER} ."
}
}
stage('Test') {
steps {
echo "Running test on ${BUILD_TAG}-${V8VER}-${PHPVER}"
sh "docker run --rm -t ${BUILD_TAG}-${V8VER}-${PHPVER} make test TESTS='ext/v8js/tests/*.phpt'"
}
}
}
}
}
}
}
24 changes: 24 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,30 @@ Vagrant.configure("2") do |config|
end
}

config.vm.define "php-7.4" do |i|
i.vm.synced_folder ".", "/data/v8js"

i.vm.provision "shell", inline: <<-SHELL
gpg --keyserver keys.gnupg.net --recv 7F438280EF8D349F
gpg --armor --export 7F438280EF8D349F | apt-key add -

apt-get update
apt-get install -y software-properties-common gdb tmux git tig curl apache2-utils lcov

add-apt-repository ppa:stesie/libv8
apt-get update
apt-get install -y libv8-7.5-dbg libv8-7.5-dev

test -x /tmp/php-src || git clone https://github.com/php/php-src.git /tmp/php-src -b PHP-7.4 --depth 1
cd /tmp/php-src
apt-get install -y build-essential bison re2c libreadline-dev
./buildconf
./configure --disable-all --with-readline
make -j4
make install
SHELL
end

config.vm.provision "shell", privileged: false, inline: <<-SHELL
sudo mkdir -p /data/build && sudo chown $USER:$USER /data/build
SHELL
Expand Down
17 changes: 9 additions & 8 deletions php_v8js_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,17 @@
#include <mutex>

#include <cmath>
#ifndef isnan
/* php.h requires the isnan() macro, which is removed by c++ <cmath> header,
* work around: re-define the macro to std::isnan function */
#define isnan(a) std::isnan(a)

/* likewise isfinite */
#define isfinite(a) std::isfinite(a)
#endif

extern "C" {
#include "php_config.h"

/* work around incompatibilities regarding isnan() and isfinite() macros,
* affecting PHP versions before 7.4. */
#undef HAVE_DECL_ISFINITE
#undef HAVE_DECL_ISNAN
#define HAVE_DECL_ISFINITE 0
#define HAVE_DECL_ISNAN 0

#include "php.h"
#include "php_v8js.h"
}
Expand Down
38 changes: 19 additions & 19 deletions tests/issue_250_001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -54,22 +54,22 @@ try {

?>
===EOF===
--EXPECTF--
Warning: Creating default object from empty value in %s%eissue_250_001.php on line 9
object(TestObject)#%d (3) {
["data":"TestObject":private]=>
object(V8Object)#%d (0) {
}
["meta":"TestObject":private]=>
array(0) {
}
["a"]=>
object(stdClass)#%d (1) {
["b"]=>
object(stdClass)#%d (1) {
["title"]=>
string(4) "ouch"
}
}
}
===EOF===
--EXPECTREGEX--
(?:Warning\: Creating default object from empty value in [^\r\n]+\/issue_250_001\.php on line 9\s*)+
object\(TestObject\)\#\d+ \(3\) \{
\["data"\:"TestObject"\:private\]\=\>
object\(V8Object\)\#\d+ \(0\) \{
\}
\["meta"\:"TestObject"\:private\]\=\>
array\(0\) \{
\}
\["a"\]\=\>
object\(stdClass\)\#\d+ \(1\) \{
\["b"\]\=\>
object\(stdClass\)\#\d+ \(1\) \{
\["title"\]\=\>
string\(4\) "ouch"
\}
\}
\}
\=\=\=EOF\=\=\=
Loading