Skip to content

Commit

Permalink
Feature/refactor with functional test (#608)
Browse files Browse the repository at this point in the history
Add files to run validation and functional tests and create code coverage output
  • Loading branch information
dsilhavy authored Nov 8, 2022
1 parent 7bd221b commit 626fe38
Show file tree
Hide file tree
Showing 14 changed files with 8,183 additions and 6 deletions.
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,8 @@ sessions/*
html-coverage
.phpunit.cache
html-reports
html-reports-functional-tests
xml-reports-functional-tests
functional-test-results
validation-test-results
Conformance-Frontend/node_modules
functional-tests/hbbtv/sources
Utils/sessions
130 changes: 130 additions & 0 deletions functional-tests/cta/functionalTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
#!/usr/bin/php7.4
<?php

use PHPUnit\Framework\TestCase;

ini_set('memory_limit', '-1');
ini_set('display_errors', 'stderr');
error_reporting(E_ERROR | E_PARSE);

require_once 'Utils/Argument.php';
require_once 'Utils/ArgumentsParser.php';

global $argumentParser;
$argumentParser = new DASHIF\ArgumentsParser();

include 'Utils/sessionHandler.php';
require 'Utils/moduleInterface.php';
include 'Utils/moduleLogger.php';

include 'Utils/Session.php'; //#Session Functions, No Direct Executable Code
//#Document loading functions, mostly xml. Some assertion options and error initialization
include 'Utils/Load.php';
include 'Utils/FileOperations.php'; //#Filesystem and XML checking functions. No Direct Executable Code.
include 'Utils/VisitorCounter.php'; //#Various Session-based functions. No Direct Executable Code.
//#Global variables. Direct evaluation of post/session vars to define conditionals,
//#conditional extra includes for module initialization
include 'Utils/GlobalVariables.php';
include 'Utils/PrettyPrint.php'; //#Pretty printing functions for terminal output. No Direct Executable Code.
include 'Utils/segment_download.php'; //#Very large function for downloading data. No Direct Executable Code.
include 'Utils/segment_validation.php'; //#Segment validation functions. No Direct Executable Code.
//#Dolby validation functions. Attempt at use of objects. No Direct Executable Code.
include 'Utils/DolbySegmentValidation.php';


include 'Utils/MPDUtility.php';


include 'DASH/module.php';
include 'CMAF/module.php';
include 'CTAWAVE/module.php';
include 'HbbTV_DVB/module.php';
include 'DASH/LowLatency/module.php';
include 'DASH/IOP/module.php';

$argumentParser->parseAll();

include 'DASH/processMPD.php';
include 'DASH/MPDFeatures.php';
include 'DASH/validateMPD.php';
include 'DASH/MPDInfo.php';
include 'DASH/SchematronIssuesAnalyzer.php';
include 'DASH/cross_validation.php';
include 'DASH/Representation.php';
include 'DASH/SegmentURLs.php';
include 'HLS/HLSProcessing.php';
include 'Conformance-Frontend/Featurelist.php';
include 'Conformance-Frontend/TabulateResults.php';


set_time_limit(0);
ini_set("log_errors", 1);
ini_set("error_log", "myphp-error.log");
ini_set("allow_url_fopen", 1);

final class functionalTest extends TestCase
{
/**
* @dataProvider streamProvider
* @large
*/
public function testThis($stream): void
{
$GLOBALS['mpd_url'] = $stream;
$enabledModules = ["MPEG-DASH Common", "CTA-WAVE", "CMAF"];
$id = null;

$GLOBALS['logger']->reset($id);
$GLOBALS['logger']->setSource($GLOBALS['mpd_url']);

foreach ($GLOBALS['modules'] as $module) {
$enabled = in_array($module->name, $enabledModules);

$module->setEnabled($enabled);
if ($module->isEnabled()) {
fwrite(STDERR, "$module->name, ");
}
}

fwrite(STDERR, "Going to parse stream " . $GLOBALS['mpd_url'] . "\n");

process_MPD(true);//MPD and Segments
//process_MPD(false);//MPD Only
//
$this->assertSame(true, true);
}

/**
* @codeCoverageIgnore
*/
public function streamProvider()
{
$i = 0;
$limit = 2000;
$startnumber = 0;
$blacklist = [
"https://dash.akamaized.net/WAVE/vectors/avc_sets/12.5_25_50/t16/2022-01-17/stream.mpd",
"https://dash.akamaized.net/WAVE/vectors/avc_sets/14.985_29.97_59.94/t16/2022-01-17/stream.mpd",
"https://dash.akamaized.net/WAVE/vectors/avc_sets/12.5_25_50/t3/2022-01-17/stream.mpd",
"https://dash.akamaized.net/WAVE/vectors/avc_sets/14.985_29.97_59.94/t3/2022-01-17/stream.mpd",
"https://dash.akamaized.net/WAVE/vectors/avc_sets/15_30_60/t16/2022-01-17/stream.mpd",
"https://dash.akamaized.net/WAVE/vectors/avc_sets/15_30_60/t3/2022-01-17/stream.mpd"
];
$content = file_get_contents(
"functional-tests/cta/wave.json");
$dbJson = json_decode($content);
$streamsToTest = array();
foreach ($dbJson as $item) {
foreach ($item as $subitem) {
if ($limit && $i >= $limit) {
break;
}
if (!in_array($subitem->mpdPath, $blacklist) && $i >= $startnumber) {
$streamsToTest[] = array($subitem->mpdPath);
}
$i++;
}
}
return $streamsToTest;
}
}
Loading

0 comments on commit 626fe38

Please sign in to comment.