mirror of
https://git.yoctoproject.org/poky
synced 2026-01-29 21:08:42 +01:00
The test was written assuming poky was being used. Update the revisions to match OE-Core instead. (From OE-Core rev: 5965ae92c866817a0bab54d240b1d197da37df2a) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
40 lines
1.4 KiB
Python
40 lines
1.4 KiB
Python
#
|
|
# Copyright OpenEmbedded Contributors
|
|
#
|
|
# SPDX-License-Identifier: MIT
|
|
#
|
|
|
|
import os
|
|
import sys
|
|
import subprocess
|
|
import shutil
|
|
from oeqa.selftest.case import OESelftestTestCase
|
|
from yocto_testresults_query import get_sha1, create_workdir
|
|
basepath = os.path.abspath(os.path.dirname(__file__) + '/../../../../../')
|
|
lib_path = basepath + '/scripts/lib'
|
|
sys.path = sys.path + [lib_path]
|
|
|
|
|
|
class TestResultsQueryTests(OESelftestTestCase):
|
|
def test_get_sha1(self):
|
|
test_data_get_sha1 = [
|
|
{"input": "yocto-4.0", "expected": "92fcb6570bddd0c5717d8cfdf38ecf3e44942b0f"},
|
|
{"input": "yocto-5.2", "expected": "6ec2c52b938302b894f119f701ffcf0a847eee85"},
|
|
]
|
|
for data in test_data_get_sha1:
|
|
test_name = data["input"]
|
|
with self.subTest(f"Test SHA1 from {test_name}"):
|
|
self.assertEqual(
|
|
get_sha1(basepath, data["input"]), data["expected"])
|
|
|
|
def test_create_workdir(self):
|
|
workdir = create_workdir()
|
|
try:
|
|
url = subprocess.check_output(
|
|
["git", "-C", workdir, "remote", "get-url", "origin"]).strip().decode("utf-8")
|
|
except:
|
|
shutil.rmtree(workdir, ignore_errors=True)
|
|
self.fail(f"Can not execute git commands in {workdir}")
|
|
shutil.rmtree(workdir)
|
|
self.assertEqual(url, "git://git.yoctoproject.org/yocto-testresults")
|