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
33 changes: 16 additions & 17 deletions .github/workflows/regression-DASHIF-db.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
name: Regression test DASH IF MPDs
name: Regression test DASH IF MPDs

on: [workflow_dispatch]

jobs:
build:

test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.13
uses: actions/setup-python@v2
with:
python-version: 3.13
- name: Install dependencies
run: |
cd tests/
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run tests
run: |
cd tests/
python -m unittest -v regression-test-DASHIF-db.py
- uses: actions/checkout@v6
- name: Set up Python 3.13
uses: actions/setup-python@v6
with:
python-version: 3.13
- name: Install dependencies
run: |
cd tests/
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run tests
run: |
cd tests/
python -m unittest -v regression-test-DASHIF-db.py
31 changes: 15 additions & 16 deletions .github/workflows/regression.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
name: Regression test industry MPDs
name: Regression test industry MPDs

on: [workflow_dispatch]

jobs:
test:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.13
uses: actions/setup-python@v2
with:
python-version: 3.13
- name: Install dependencies
run: |
cd tests/
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run tests
run: |
cd tests/
python -m unittest -v regression-test.py
- uses: actions/checkout@v6
- name: Set up Python 3.13
uses: actions/setup-python@v6
with:
python-version: 3.13
- name: Install dependencies
run: |
cd tests/
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run tests
run: |
cd tests/
python -m unittest -v regression-test.py
29 changes: 14 additions & 15 deletions .github/workflows/validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,20 @@ on: [push, pull_request, workflow_dispatch]

jobs:
test:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.13
uses: actions/setup-python@v2
with:
python-version: 3.13
- name: Install dependencies
run: |
cd tests/
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run tests
run: |
cd tests/
python -m unittest -v validate.py
- uses: actions/checkout@v6
- name: Set up Python 3.13
uses: actions/setup-python@v6
with:
python-version: 3.13
- name: Install dependencies
run: |
cd tests/
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run tests
run: |
cd tests/
python -m unittest -v validate.py
21 changes: 18 additions & 3 deletions tests/regression-test-DASHIF-db.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,39 @@

DASHIF_dataset_url = "https://raw.githubusercontent.com/Dash-Industry-Forum/Test-Assets-Dataset-Public/master/dataset/data/testvector.json"

class PrefixResolver(etree.Resolver):
# https://lxml.de/resolvers.html
def __init__(self, prefix):
self.prefix = prefix.lower()

def resolve(self, url, pubid, context):
if url.lower().startswith(self.prefix):
res=requests.get(url, allow_redirects=True)
return self.resolve_string(res.text, context)

class TestManifests(unittest.TestCase):
def setUp(self):
self.log = logging.getLogger('MDP_tests')
logging.basicConfig(stream=sys.stderr, level=logging.INFO)
self.log.info('Loading MPEG DASH schema')
self.xsdParser=etree.XMLParser(load_dtd=True, no_network=False, huge_tree=True, resolve_entities=True)
self.xsdParser.resolvers.add(PrefixResolver("https"))
self.xsdParser.resolvers.add(PrefixResolver("http"))
with open('../DASH-MPD.xsd', 'r') as schema_file:
self.mpd_schema = etree.XMLSchema(etree.parse(schema_file, self.xsdParser))
# is_python3 = sys.version_info.major == 3
self.xmlParser=etree.XMLParser(load_dtd=True, no_network=False, huge_tree=True, resolve_entities=True)
self.xmlParser.resolvers.add(PrefixResolver("https"))
self.xmlParser.resolvers.add(PrefixResolver("http"))

def check_a_manifest(self, mpdURL, source):
with self.subTest(msg=mpdURL):
self.log.info('Validating {%s} %s', source, mpdURL)
try:
mpdRequest=requests.get(mpdURL, allow_redirects=True)
mpdRequest=requests.get(mpdURL, allow_redirects=True, timeout=2.50)
except Exception as err:
self.fail(err)
self.skipTest("failed to retrieve manifest")
else:
self.assertEqual(mpdRequest.status_code, 200, "Request error; expected 200, got %d" % mpdRequest.status_code)
if mpdRequest.status_code == 200:
mpdUrl = mpdRequest.text
strt=mpdUrl.find('<')
Expand All @@ -46,6 +59,8 @@ def check_a_manifest(self, mpdURL, source):
mpd=etree.fromstring((mpdUrl).encode('utf8'), self.xmlParser)
if not self.mpd_schema.validate(mpd):
self.fail(self.mpd_schema.error_log.filter_from_errors())
else:
self.skipTest("response not 200 OK")

def check_manifests(self, mpdList, source):
for mpdURL in mpdList:
Expand Down
21 changes: 17 additions & 4 deletions tests/regression-test.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,24 @@
MPEGCMAFManifestsFile="MPEG-CMAF-manifests.json"
DASHIFManifestsFile="DASH-IF-manifests.json"

class PrefixResolver(etree.Resolver):
# https://lxml.de/resolvers.html
def __init__(self, prefix):
self.prefix = prefix.lower()

def resolve(self, url, pubid, context):
if url.lower().startswith(self.prefix):
res=requests.get(url, allow_redirects=True)
return self.resolve_string(res.text, context)

class TestManifests(unittest.TestCase):
def setUp(self):
self.log = logging.getLogger('MDP_tests')
logging.basicConfig(stream=sys.stderr, level=logging.INFO)
self.log.info('Loading MPEG DASH schema')
self.xsdParser=etree.XMLParser(load_dtd=True, no_network=False, huge_tree=True, resolve_entities=True)
self.xsdParser.resolvers.add(PrefixResolver("https"))
self.xsdParser.resolvers.add(PrefixResolver("http"))
with open('../DASH-MPD.xsd', 'r') as schema_file:
self.mpd_schema = etree.XMLSchema(etree.parse(schema_file, self.xsdParser))
# is_python3 = sys.version_info.major == 3
Expand All @@ -36,19 +48,20 @@ def check_a_manifest(self, mpdURL, source):
with self.subTest(msg=mpdURL):
self.log.info('Validating {%s} %s', source, mpdURL)
try:
mpdRequest=requests.get(mpdURL, allow_redirects=True)
mpdRequest=requests.get(mpdURL, allow_redirects=True, timeout=2.50)
except Exception as err:
self.fail(err)
self.skipTest("failed to retrieve manifest")
else:
self.assertEqual(mpdRequest.status_code, 200, "Request error; expected 200, got %d" % mpdRequest.status_code)
if mpdRequest.status_code == 200:
if mpdRequest.status_code == 200:
mpdUrl = mpdRequest.text
strt=mpdUrl.find('<')
if strt > 0:
mpdUrl = mpdUrl[strt:]
mpd=etree.fromstring((mpdUrl).encode('utf8'), self.xmlParser)
if not self.mpd_schema.validate(mpd):
self.fail(self.mpd_schema.error_log.filter_from_errors())
else:
self.skipTest("response not 200 OK")

def check_manifests(self, mpdList, source):
for mpdURL in mpdList:
Expand Down
4 changes: 2 additions & 2 deletions tests/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def setUp(self):
self.parser.resolvers.add(PrefixResolver("http"))

def test_mpds(self):
""" Test all MPDs found in the repository."""
self.log.info("Test all MPDs found in the repository.")
with open('../DASH-MPD.xsd', 'r') as schema_file:
mpd_schema = etree.XMLSchema( etree.parse(schema_file, self.parser) )
for mpd_path in glob.glob('../*.mpd'):
Expand All @@ -42,7 +42,7 @@ def test_mpds(self):


def test_mpps(self):
""" Test all MPPs found in the repository."""
self.log.info(" Test all MPPs found in the repository.")
with open('../DASH-MPD-PATCH.xsd', 'r') as mpp_schema_file:
mpp_schema = etree.XMLSchema( etree.parse(mpp_schema_file, self.parser) )
for mpp_path in glob.glob('../*.mpp'):
Expand Down