Skip to content
Permalink
Browse files

Merge branch 'ci'

  • Loading branch information...
derickr committed Mar 8, 2019
2 parents 136f37d + cc7c274 commit 29124010093a758e9e8863cf1d3ce301d787c79f
Showing with 112 additions and 27 deletions.
  1. +72 −0 .xdebugci/ingest.php
  2. +1 −1 { → .xdebugci}/rebuild-all.sh
  3. +7 −2 { → .xdebugci}/test-all.sh
  4. +32 −0 .xdebugci/test-thread.sh
  5. +0 −23 test-thread.sh
  6. +0 −1 test.sh
@@ -0,0 +1,72 @@
<?php
$m = new \MongoDB\Driver\Manager( "mongodb+srv://ci-writer:{$_ENV['CIWRITEPASSWORD']}@xdebugci-qftmo.mongodb.net/test?retryWrites=true" );
/* Create RUN ID */
$runId = (new \DateTimeImmutable())->format( "Y-m-d-H-i-s" );
$timeStamp = time();
/* Read all JUNIT logs */
foreach ( glob( '/tmp/ptester/junit/*.xml' ) as $file )
{
preg_match( '@junit/((.*?)(-32bit)?(-zts)?)\.xml@', $file, $matches );
$config = $matches[1];
$version = $matches[2];
$_32bit = $matches[3] == '-32bit';
$zts = $matches[4] == '-zts';
$xml = SimpleXML_load_string( file_get_contents( $file ) );
$status = [
'_id' => $runId . '@' . $config,
'run' => $runId,
'ts' => $timeStamp,
'cfg' => [
'config' => $config,
'version' => $version,
'zts' => $zts,
'32bit' => $_32bit,
],
];
if ( isset( $xml['buildFailed'] ) )
{
$status['buildSuccess'] = false;
$status['buildLog'] = file_get_contents( (string) $xml['buildLogFile' ] );
}
else
{
$status['buildSuccess'] = true;
$status['stats'] = [
'tests' => (int) $xml['tests'],
'failures' => (int) $xml['failures'],
'errors' => (int) $xml['errors'],
'skip' => (int) $xml['skip'],
'time' => (double) $xml['time'],
];
}
if ( (int) $xml['failures'] != 0 )
{
foreach ( $xml as $testsuite )
{
foreach ( $testsuite->testcase as $testcase )
{
if ( isset ( $testcase->failure['type'] ) )
{
preg_match( "@PHP\.tests\.(.*)\.phpt@", (string) $testcase['classname'], $matches );
$status['failures'][] = [
'file' => $matches[1],
'desc' => (string) $testcase['name'],
'reason' => (string) $testcase->failure,
];
}
}
}
}
$bulk = new \MongoDB\Driver\BulkWrite;
$bulk->insert( $status );
$m->executeBulkWrite( 'ci.run', $bulk );
}
@@ -17,7 +17,7 @@ for i in /usr/local/php/*; do

LOG="/tmp/xdebug-for-${version}.log"
echo -n "Building: "
./rebuild.sh >$LOG 2>&1
../rebuild.sh >$LOG 2>&1

if [[ $? == 0 ]]; then
echo "DONE"
@@ -5,7 +5,8 @@ PATTERN=${1:-'7.3*'}
PHP_DIR=${PHP_DIR:-/usr/local/php}
SYSTEM_CORES=`nproc`
NPROC=${NPROC:-$SYSTEM_CORES}

MYFILE=`realpath $0`
MYDIR=`dirname ${MYFILE}`
PHPS=`ls -vd ${PHP_DIR}/${PATTERN}`

mkdir -p /tmp/ptester
@@ -34,10 +35,14 @@ for i in `seq 0 $MAX`; do
GroupName=`printf group%03d.lst $i`

if [ -s /tmp/ptester/$GroupName ]; then
./test-thread.sh $i `cat /tmp/ptester/$GroupName` &
${MYDIR}/test-thread.sh $i `cat /tmp/ptester/$GroupName` &
fi
done

wait

echo -n "Storing test results... "

php -dextension=mongodb.so ${MYDIR}/ingest.php

echo "DONE"
@@ -0,0 +1,32 @@
#!/bin/bash

TID="$1"
shift

rm -rf /tmp/ptester/thread/${TID}
mkdir -p /tmp/ptester/thread/${TID}
CWD=`pwd`
MYFILE=`realpath $0`
MYDIR=`dirname ${MYFILE}`
cp run-xdebug-tests.php /tmp/ptester/thread/${TID}

cd /tmp/ptester/thread/${TID}

for i in $@; do
PATH=/usr/local/php/$i/bin:$PATH

mkdir -p /tmp/ptester/thread/${TID}/$i/tmp-xdebug
cp -r ${CWD}/* /tmp/ptester/thread/${TID}/$i/tmp-xdebug
cd /tmp/ptester/thread/${TID}/$i/tmp-xdebug

printf "%2d %6d: Rebuilding for %s\n" $TID $BASHPID $i
./rebuild.sh >/tmp/ptester/logs/$i.build.log 2>&1

if [ "$?" == "1" ]; then
printf "%2d %6d: Build failed for %s\n" $TID $BASHPID $i
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?><testsuites buildFailed=\"1\" buildLogFile=\"/tmp/ptester/logs/$i.build.log\"/>" >> /tmp/ptester/junit/${i}.xml
else
printf "%2d %6d: Testing for %s\n" $TID $BASHPID $i
SKIP_DBGP_TESTS=1 SKIP_UNPARALLEL_TESTS=1 TEST_PHP_EXECUTABLE=`which php` TEST_PHP_JUNIT="/tmp/ptester/junit/$i.xml" php run-xdebug-tests.php /tmp/ptester/thread/${TID}/${i}/tmp-xdebug/tests >/tmp/ptester/logs/$i.log 2>&1
fi
done

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.

0 comments on commit 2912401

Please sign in to comment.
You can’t perform that action at this time.