diff --git a/.cspell.json b/.cspell.json index 963ec26f..9c4de8ab 100644 --- a/.cspell.json +++ b/.cspell.json @@ -113,6 +113,8 @@ "smbios", "Contoso", "MSFT", - "codecov" + "codecov", + "qemu", + "ovmf" ] } diff --git a/integration_test/.gitignore b/integration_test/.gitignore new file mode 100644 index 00000000..be9583f0 --- /dev/null +++ b/integration_test/.gitignore @@ -0,0 +1,2 @@ +/test +/report diff --git a/integration_test/ReadMe.md b/integration_test/ReadMe.md new file mode 100644 index 00000000..c1e5b184 --- /dev/null +++ b/integration_test/ReadMe.md @@ -0,0 +1,77 @@ +# Integration testing for Edk2 Pytool Extensions + +This describes what is needed to run integration testing on pytool extensions. This testing will use known compatible and public open source repositories for validation. This set of automated tests will run common user level operations and validate that pytools works as expected. Some basic examples are: + +* Build Edk2 OvmfPkg Platform CI +* Run Core Ci on Edk2 MdeModulePkg +* After committing a change in the repo use pr_eval to confirm the correct packages need testing. + +## Prerequisites + +* Standard Edk2 Prerequisites + * git cli + * Python 3.8.x with support for Pip and virtual environment + * VS 2019 (Windows Only) + * GCC (Linux Only) +* Additional requirements + * robot framework + * QEMU (on your path) + +## Process + +1. Create new virtual environment +2. Activate virtual environment +3. Clone edk2-pytool-extension +4. Check out desired version/branch and cd to root (folder where *setup.py* is located) +5. Pip Install the local version by running `pip install -e .` in the root directory +6. Pip install remaining dependencies by running `pip install --upgrade -r integration_test/pip-requirements.txt` +7. cd to *integration_test* directory (folder where *this* document is located) +8. Run robot `python -m robot.run -v TEST_OUTPUT_BASE:test -d report ` + 1. use `.` to run all test cases in all robot files in the current directory + 2. use `edk2_stuart_pr_eval.robot` robot file for testing stuart pr eval using edk2 repo + 3. use `edk2_core_ci.robot` robot file for running parts of the core ci tests on edk2 + 4. use `edk2_platform_ci.robot` robot file for running parts of the platform ci tests on edk2 + +## Additional useful CLI flags + +1. Only run test cases with a given tag + 1. `--include CoreCI` to run only the CoreCI tests + 2. `--include PlatformCI` to run only the Platform CI tests + 3. `--include PrEval` to run only the pr_eval tests + 4. `--include Edk2` to run only on edk2 repo + 5. `--include ProjectMu` to run only on Project Mu basecore repo +2. More Debug info in log + 1. `-L TRACE` to run with most detailed info + 2. `-L DEBUG` to turn on debug level. This is less than trace + 3. `-L INFO` this is the default level. +3. Set more variables + 1. `-v :` set a variable for your robot file + +## Lessons learned/Tips + +### Robot hangs for seemingly unknown reason + +It is well known that robot will hang if you "log too much" from Run Process. For example running git clone can sometimes +create a large log. So for those commands which can create a large log redirect stdout and stderr to a file. To do this +add additional parameters to your "Run Process" cmd like so `stdout=stdout.txt stderr=stderr.txt`. For an example in action +look at the keywords for all stuart commands. + +### Run a single test so you can collect the logs from the file system + +Robot framework supports running a single test by providing the test name. The robot.run command should +add `-t "the test case name here"`. This has been useful to run a single failing test on your filesystem and then +collect the stuart log to debug problems. + +## Helpful Robot Links + +https://robotframework.org is the main site. Lots of good info here. My most commonly used pages are: + +* UserGuide: https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html +* Operating System Library: https://robotframework.org/robotframework/latest/libraries/OperatingSystem.html +* BuiltIn Library: https://robotframework.org/robotframework/latest/libraries/BuiltIn.html +* String Library: https://robotframework.org/robotframework/latest/libraries/String.html + +## Copyright + +Copyright (c) Microsoft Corporation. +SPDX-License-Identifier: BSD-2-Clause-Patent \ No newline at end of file diff --git a/integration_test/Shared_Keywords.robot b/integration_test/Shared_Keywords.robot new file mode 100644 index 00000000..aad9c1a9 --- /dev/null +++ b/integration_test/Shared_Keywords.robot @@ -0,0 +1,178 @@ +*** Settings *** +Documentation A shared set of common keywords for stuart operations and git operations +# +# Copyright (c), Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent + +Library Process +Library OperatingSystem + +# Suite Setup + +*** Variables *** + +#Test output location +${TEST_OUTPUT} ${TEST_OUTPUT_BASE} + +*** Keywords *** + +### list comparison helper ### +Confirm same contents + [Arguments] ${actual} ${expected} + @{epkgs}= Split String ${expected} , + @{apkgs}= Split String ${actual} , + + FOR ${a} IN @{apkgs} + Should Contain ${expected} ${a} + END + + FOR ${b} IN @{epkgs} + Should Contain ${actual} ${b} + END + +### Git operations ### +Clone the git repo + [Arguments] ${git_url} ${ws_name} + + Log To console cloning ${git_url} to ${TEST_OUTPUT} + ${result}= Run Process git.exe clone ${git_url} ${ws_name} + ... cwd=${TEST_OUTPUT} stdout=stdout.txt stderr=stderr.txt + Log Many stdout: ${result.stdout} stderr: ${result.stderr} + + ${result}= Run Process git fetch --all --prune + ... cwd=${TEST_OUTPUT}${/}${ws_name} stdout=stdout.txt stderr=stderr.txt + Log Many stdout: ${result.stdout} stderr: ${result.stderr} + Should Be Equal As Integers ${result.rc} 0 + +Reset git repo to main branch + [Arguments] ${ws} ${main_branch_name} + + # checkout remote tag for origin/master + ${result}= Run Process git checkout origin/${main_branch_name} + ... cwd=${ws} stdout=stdout.txt stderr=stderr.txt + Log Many stdout: ${result.stdout} stderr: ${result.stderr} + Should Be Equal As Integers ${result.rc} 0 + + # clean non ignored files quietly to avoid log overflow + ${result}= Run Process git clean -qfd cwd=${ws} + Log Many stdout: ${result.stdout} stderr: ${result.stderr} + Should Be Equal As Integers ${result.rc} 0 + + # reset to restore files + ${result}= Run Process git reset --hard + ... cwd=${ws} stdout=stdout.txt stderr=stderr.txt + Log Many stdout: ${result.stdout} stderr: ${result.stderr} + Should Be Equal As Integers ${result.rc} 0 + +Make new branch + [Arguments] ${name} ${ws} + ${result}= Run Process git checkout -b ${name} + ... cwd=${ws} shell=True + Log Many stdout: ${result.stdout} stderr: ${result.stderr} + Should Be Equal As Integers ${result.rc} 0 + +Delete branch + [Arguments] ${name} ${to_branch} ${ws} + Run Keyword Switch branch ${to_branch} ${ws} + ${result}= Run Process git branch -D ${name} + ... cwd=${ws} shell=True + Log Many stdout: ${result.stdout} stderr: ${result.stderr} + Should Be Equal As Integers ${result.rc} 0 + +Switch branch + [Arguments] ${name} ${ws} + ${result}= Run Process git checkout ${name} + ... cwd=${ws} shell=True + Log Many stdout: ${result.stdout} stderr: ${result.stderr} + Should Be Equal As Integers ${result.rc} 0 + +Stage changed file + [Arguments] ${file_path} ${ws} + ${result}= Run Process git add ${file_path} + ... cwd=${ws} shell=True + Log Many stdout: ${result.stdout} stderr: ${result.stderr} + Should Be Equal As Integers ${result.rc} 0 + +Commit changes + [Arguments] ${msg} ${ws} + ${result}= Run Process git commit -m ${msg} + ... cwd=${ws} shell=True + Log Many stdout: ${result.stdout} stderr: ${result.stderr} + Should Be Equal As Integers ${result.rc} 0 + +### Stuart operations ### +Stuart setup + [Arguments] ${setting_file} ${arch} ${target} ${packages} ${tool_chain} ${ws} + Log to console Stuart Setup + ${result}= Run Process stuart_setup + ... -c ${setting_file} -a ${arch} TOOL_CHAIN_TAG\=${tool_chain} -t ${target} -p ${packages} TARGET\=${target} + ... cwd=${ws} stdout=stdout.txt stderr=stderr.txt + Log Many stdout: ${result.stdout} stderr: ${result.stderr} + Should Be Equal As Integers ${result.rc} 0 + +Stuart ci setup + [Arguments] ${setting_file} ${arch} ${target} ${packages} ${tool_chain} ${ws} + Log to console Stuart CI Setup + ${result}= Run Process stuart_ci_setup + ... -c ${setting_file} -a ${arch} TOOL_CHAIN_TAG\=${tool_chain} -t ${target} -p ${packages} TARGET\=${target} + ... cwd=${ws} stdout=stdout.txt stderr=stderr.txt + Log Many stdout: ${result.stdout} stderr: ${result.stderr} + Should Be Equal As Integers ${result.rc} 0 + +Stuart update + [Arguments] ${setting_file} ${arch} ${target} ${packages} ${tool_chain} ${ws} + Log to console Stuart Update + ${result}= Run Process stuart_update + ... -c ${setting_file} -a ${arch} TOOL_CHAIN_TAG\=${tool_chain} -t ${target} -p ${packages} TARGET\=${target} + ... cwd=${ws} stdout=stdout.txt stderr=stderr.txt + Log Many stdout: ${result.stdout} stderr: ${result.stderr} + Should Be Equal As Integers ${result.rc} 0 + +Stuart platform build + [Arguments] ${setting_file} ${arch} ${target} ${tool_chain} ${ws} + Log to console Stuart Build + ${result}= Run Process stuart_build + ... -c ${setting_file} -a ${arch} TOOL_CHAIN_TAG\=${tool_chain} TARGET\=${target} + ... cwd=${ws} stdout=stdout.txt stderr=stderr.txt + Log Many stdout: ${result.stdout} stderr: ${result.stderr} + Should Be Equal As Integers ${result.rc} 0 + +Stuart platform run + [Arguments] ${setting_file} ${arch} ${target} ${tool_chain} ${addtional_flags} ${ws} + Log to console Stuart Build Run + ${result}= Run Process stuart_build + ... -c ${setting_file} -a ${arch} TOOL_CHAIN_TAG\=${tool_chain} TARGET\=${target} --FlashOnly ${addtional_flags} + ... cwd=${ws} stdout=stdout.txt stderr=stderr.txt + Log Many stdout: ${result.stdout} stderr: ${result.stderr} + Should Be Equal As Integers ${result.rc} 0 + +Stuart CI build + [Arguments] ${setting_file} ${archs} ${targets} ${packages} ${tool_chain} ${ws} + Log to console Stuart CI Build + ${result}= Run Process stuart_ci_build + ... -c ${setting_file} -a ${archs} -t ${targets} -p ${packages} TOOL_CHAIN_TAG\=${tool_chain} + ... cwd=${ws} stdout=stdout.txt stderr=stderr.txt + Log Many stdout: ${result.stdout} stderr: ${result.stderr} + Should Be Equal As Integers ${result.rc} 0 + +Stuart pr evaluation + [Documentation] Run Pr Eval + [Arguments] ${setting_file} ${packages} ${base_ref} ${other_build_flags} ${ws} + + ${result}= Run Process stuart_pr_eval + ... -c ${setting_file} -p ${packages} --pr-target origin/${base_ref} + ... --output-csv-format-string {pkgcsv} + ... cwd=${ws} stdout=stdout.txt stderr=stderr.txt + Log Many stdout: ${result.stdout} stderr: ${result.stderr} + Should Be Equal As Integers ${result.rc} 0 + Return From Keyword ${result.stdout} + +### Edk2 BaseTools Build operations ### +Build BaseTools + [Arguments] ${tool_chain} ${ws} + Log to console Compile basetools + ${result}= Run Process python + ... BaseTools/Edk2ToolsBuild.py -t ${tool_chain} + ... cwd=${ws} shell=True stdout=stdout.txt stderr=stderr.txt + Log Many stdout: ${result.stdout} stderr: ${result.stderr} + Should Be Equal As Integers ${result.rc} 0 diff --git a/integration_test/edk2_core_ci.robot b/integration_test/edk2_core_ci.robot new file mode 100644 index 00000000..e3648c8f --- /dev/null +++ b/integration_test/edk2_core_ci.robot @@ -0,0 +1,105 @@ +*** Settings *** +Documentation A test suite to test Core CI on edk2 repo +# +# Copyright (c), Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent + +Library Process +Library OperatingSystem +Library String + +Resource Shared_Keywords.robot + +Suite Setup One time setup ${repo_url} ${ws_dir} + +# Suite Setup + +*** Variables *** +${repo_url} https://github.com/tianocore/edk2.git +${master_branch} master +${ws_dir} edk2 +${ci_file} .pytool/CISettings.py +${ws_root} ${TEST_OUTPUT}${/}${ws_dir} +${tool_chain} VS2019 + + +*** Keywords *** +One time setup + [Arguments] ${url} ${folder} + ## Dump pip versions + ${result}= Run Process python -m pip list shell=True + Log ${result.stdout} + + ## Make output directory if doesn't already exist + Create Directory ${TEST_OUTPUT} + + ## Clone repo + Run Keyword Clone the git repo ${url} ${folder} + + +*** Test Cases *** + +Run Edk2 MdePkg CoreCI Debug + [Documentation] This Test will run X64 DEBUG build of Core CI on the MdePkg + [Tags] CoreCI Windows VS2019 Compile Edk2 + + ${archs}= Set Variable X64 + ${targets}= Set Variable DEBUG + ${packages}= Set Variable MdePkg + + # make sure on master + Reset git repo to main branch ${ws_root} ${master_branch} + + Stuart setup ${ci_file} ${archs} ${targets} ${packages} ${tool_chain} ${ws_root} + Stuart update ${ci_file} ${archs} ${targets} ${packages} ${tool_chain} ${ws_root} + Build BaseTools ${tool_chain} ${ws_root} + Stuart CI build ${ci_file} ${archs} ${targets} ${packages} ${tool_chain} ${ws_root} + +Run Edk2 SecurityPkg CoreCI Release + [Documentation] This Test will run IA32 RELEASE build of Core CI on the SecurityPkg + [Tags] CoreCI Windows VS2019 Compile Edk2 + + ${archs}= Set Variable IA32 + ${targets}= Set Variable RELEASE + ${packages}= Set Variable SecurityPkg + + # make sure on master + Reset git repo to main branch ${ws_root} ${master_branch} + + Stuart setup ${ci_file} ${archs} ${targets} ${packages} ${tool_chain} ${ws_root} + Stuart update ${ci_file} ${archs} ${targets} ${packages} ${tool_chain} ${ws_root} + Build BaseTools ${tool_chain} ${ws_root} + Stuart CI build ${ci_file} ${archs} ${targets} ${packages} ${tool_chain} ${ws_root} + +Run Edk2 UefiCpuPkg CoreCI for No-Target + [Documentation] This Test will run NO-TARGET Core CI test on the UefiCpuPkg + [Tags] CoreCI Windows VS2019 NO-TARGET Edk2 + + ${archs}= Set Variable X64,IA32,AARCH64,ARM + ${targets}= Set Variable NO-TARGET + ${packages}= Set Variable UefiCpuPkg + + # make sure on master + Reset git repo to main branch ${ws_root} ${master_branch} + + Stuart setup ${ci_file} ${archs} ${targets} ${packages} ${tool_chain} ${ws_root} + Stuart update ${ci_file} ${archs} ${targets} ${packages} ${tool_chain} ${ws_root} + Build BaseTools ${tool_chain} ${ws_root} + Stuart CI build ${ci_file} ${archs} ${targets} ${packages} ${tool_chain} ${ws_root} + +Run Edk2 MdeModulePkg CoreCI for NOOPT and HostTest + [Documentation] This Test will run NOOPT Core CI which includes Host-Tests on the MdeModulePkg + [Tags] CoreCI Windows VS2019 NOOPT HOST-TEST Edk2 + + ${archs}= Set Variable X64 + ${targets}= Set Variable NOOPT + ${packages}= Set Variable MdeModulePkg + + # make sure on master + Reset git repo to main branch ${ws_root} ${master_branch} + + Stuart setup ${ci_file} ${archs} ${targets} ${packages} ${tool_chain} ${ws_root} + Stuart update ${ci_file} ${archs} ${targets} ${packages} ${tool_chain} ${ws_root} + Build BaseTools ${tool_chain} ${ws_root} + Stuart CI build ${ci_file} ${archs} ${targets} ${packages} ${tool_chain} ${ws_root} + diff --git a/integration_test/edk2_platform_ci.robot b/integration_test/edk2_platform_ci.robot new file mode 100644 index 00000000..b1219217 --- /dev/null +++ b/integration_test/edk2_platform_ci.robot @@ -0,0 +1,71 @@ +*** Settings *** +Documentation A test suite to test Platform CI on edk2 repo +# +# Copyright (c), Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent + +Library Process +Library OperatingSystem +Library String + +Resource Shared_Keywords.robot + +Suite Setup One time setup ${repo_url} ${ws_dir} + +# Suite Setup + +*** Variables *** +${repo_url} https://github.com/tianocore/edk2.git +${master_branch} master +${ws_dir} edk2 +${ws_root} ${TEST_OUTPUT}${/}${ws_dir} +${tool_chain} VS2019 + + +*** Keywords *** +One time setup + [Arguments] ${url} ${folder} + ## Dump pip versions + ${result}= Run Process python -m pip list shell=True + Log ${result.stdout} + + ## Make output directory if doesn't already exist + Create Directory ${TEST_OUTPUT} + + ## Clone repo + Run Keyword Clone the git repo ${url} ${folder} + +*** Test Cases *** +Run Edk2 Ovmf PlatformCI + [Documentation] This Test will run Platform CI on the OvmfPkg X64 + [Tags] PlatformCI OVMF X64 VS2019 Windows QEMU Edk2 + ${arch}= Set Variable X64 + ${target}= Set Variable DEBUG + ${package}= Set Variable OvmfPkg + ${ci_file}= Set Variable ${package}${/}PlatformCI${/}PlatformBuild.py + + # make sure on master + Reset git repo to main branch ${ws_root} ${master_branch} + + Stuart setup ${ci_file} ${arch} ${target} ${package} ${tool_chain} ${ws_root} + Stuart update ${ci_file} ${arch} ${target} ${package} ${tool_chain} ${ws_root} + Build BaseTools ${tool_chain} ${ws_root} + Stuart platform build ${ci_file} ${arch} ${target} ${tool_chain} ${ws_root} + Stuart platform run ${ci_file} ${arch} ${target} ${tool_chain} MAKE_STARTUP_NSH\=TRUE ${ws_root} + +Run Edk2 EmulatorPkg PlatformCI + [Documentation] This Test will run Platform CI on the EmulatorPkg X64 + [Tags] PlatformCI X64 VS2019 Windows EmulatorPkg Edk2 + ${arch}= Set Variable X64 + ${target}= Set Variable NOOPT + ${package}= Set Variable EmulatorPkg + ${ci_file}= Set Variable ${package}${/}PlatformCI${/}PlatformBuild.py + + # make sure on master + Reset git repo to main branch ${ws_root} ${master_branch} + + Stuart setup ${ci_file} ${arch} ${target} ${package} ${tool_chain} ${ws_root} + Stuart update ${ci_file} ${arch} ${target} ${package} ${tool_chain} ${ws_root} + Build BaseTools ${tool_chain} ${ws_root} + Stuart platform build ${ci_file} ${arch} ${target} ${tool_chain} ${ws_root} + Stuart platform run ${ci_file} ${arch} ${target} ${tool_chain} MAKE_STARTUP_NSH\=TRUE ${ws_root} diff --git a/integration_test/edk2_stuart_pr_eval.robot b/integration_test/edk2_stuart_pr_eval.robot new file mode 100644 index 00000000..64953694 --- /dev/null +++ b/integration_test/edk2_stuart_pr_eval.robot @@ -0,0 +1,315 @@ +*** Settings *** +Documentation A test suite to test Stuart Pr Eval +# +# Copyright (c), Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent + +Library Process +Library OperatingSystem +Library String + +Resource Shared_Keywords.robot + +Suite Setup One time setup ${repo_url} ${ws_dir} + +# Suite Setup + +*** Variables *** +${repo_url} https://github.com/tianocore/edk2.git +${master_branch} master +${ws_dir} edk2 +${core_ci_file} .pytool/CISettings.py +${platform_ci_file} OvmfPkg${/}PlatformCI${/}PlatformBuild.py + +${ws_root} ${TEST_OUTPUT}${/}${ws_dir} + + +*** Keywords *** +One time setup + [Arguments] ${url} ${folder} + ## Dump pip versions + ${result}= Run Process python -m pip list shell=True + Log ${result.stdout} + + ## Make output directory if doesn't already exist + Create Directory ${TEST_OUTPUT} + + ## Clone repo + Run Keyword Clone the git repo ${url} ${folder} + +*** Test Cases *** + +Test Stuart PR for Policy 1 special files in PrEvalSettingsManager + [Tags] PrEval Edk2 + + ${branch_name}= Set Variable PR_Rand_${{random.randint(0, 10000)}} + ${file_to_modify}= Set Variable BaseTools${/}Source${/}C${/}GenFv${/}GenFv.c + + Reset git repo to main branch ${ws_root} ${master_branch} + Make new branch ${branch_name} ${ws_root} + + Append To File ${ws_root}${/}${file_to_modify} + ... Hello World!! Making a change for fun. + + Stage changed file ${file_to_modify} ${ws_root} + Commit changes "Changes" ${ws_root} + + # Core CI test package dependency # Policy 3 + ${pkgs}= Stuart pr evaluation ${core_ci_file} MdePkg,MdeModulePkg,ArmVirtPkg ${master_branch} ${EMPTY} ${ws_root} + Confirm same contents ${pkgs} MdePkg,MdeModulePkg,ArmVirtPkg + + [Teardown] Delete branch ${branch_name} ${master_branch} ${ws_root} + +Test Stuart PR for Policy 2 in package change of private inf file + [Tags] PrEval Edk2 + + ${branch_name}= Set Variable PR_Rand_${{random.randint(0, 10000)}} + ${file_to_modify}= Set Variable MdePkg${/}Library${/}BaseLib${/}BaseLib.inf + + Reset git repo to main branch ${ws_root} ${master_branch} + Make new branch ${branch_name} ${ws_root} + + Append To File ${ws_root}${/}${file_to_modify} + ... Hello World!! Making a change for fun. + + Stage changed file ${file_to_modify} ${ws_root} + Commit changes "Changes" ${ws_root} + + # Core CI test same package # policy 2 + ${pkgs}= Stuart pr evaluation ${core_ci_file} MdePkg ${master_branch} ${EMPTY} ${ws_root} + Confirm same contents ${pkgs} MdePkg + + # Core CI test another package and make sure a it doesn't need to build + ${pkgs}= Stuart pr evaluation ${core_ci_file} MdeModulePkg ${master_branch} ${EMPTY} ${ws_root} + Should Be Empty ${pkgs} + + [Teardown] Delete branch ${branch_name} ${master_branch} ${ws_root} + + +Test Stuart PR for Policy 3 for package dependency on change of public header file + [Tags] PrEval Edk2 + + ${branch_name}= Set Variable PR_Rand_${{random.randint(0, 10000)}} + ${file_to_modify}= Set Variable MdePkg${/}Include${/}Protocol${/}DevicePath.h + + Reset git repo to main branch ${ws_root} ${master_branch} + Make new branch ${branch_name} ${ws_root} + + Append To File ${ws_root}${/}${file_to_modify} + ... Hello World!! Making a change for fun. + + Stage changed file ${file_to_modify} ${ws_root} + Commit changes "Changes" ${ws_root} + + # Core CI test package dependency # Policy 3 + ${pkgs}= Stuart pr evaluation ${core_ci_file} MdeModulePkg,UefiCpuPkg ${master_branch} ${EMPTY} ${ws_root} + Confirm same contents ${pkgs} MdeModulePkg,UefiCpuPkg + + [Teardown] Delete branch ${branch_name} ${master_branch} ${ws_root} + +Test Stuart PR for Policy 3 for package dependency on change of public header file not dependent + [Tags] PrEval Edk2 + + ${branch_name}= Set Variable PR_Rand_${{random.randint(0, 10000)}} + ${file_to_modify}= Set Variable CryptoPkg${/}Include${/}Library${/}TlsLib.h + + Reset git repo to main branch ${ws_root} ${master_branch} + Make new branch ${branch_name} ${ws_root} + + Append To File ${ws_root}${/}${file_to_modify} + ... Hello World!! Making a change for fun. + + Stage changed file ${file_to_modify} ${ws_root} + Commit changes "Changes" ${ws_root} + + # Core CI test package dependency # Policy 3 + ${pkgs}= Stuart pr evaluation ${core_ci_file} MdePkg,MdeModulePkg,UefiCpuPkg ${master_branch} ${EMPTY} ${ws_root} + Should Be Empty ${pkgs} + + [Teardown] Delete branch ${branch_name} ${master_branch} ${ws_root} + +Test Stuart PR for Policy 3 for package dependency on change of package dec file + [Tags] PrEval Edk2 + + ${branch_name}= Set Variable PR_Rand_${{random.randint(0, 10000)}} + ${file_to_modify}= Set Variable SecurityPkg${/}SecurityPkg.dec + + Reset git repo to main branch ${ws_root} ${master_branch} + Make new branch ${branch_name} ${ws_root} + + Append To File ${ws_root}${/}${file_to_modify} + ... Hello World!! Making a change for fun. + + Stage changed file ${file_to_modify} ${ws_root} + Commit changes "Changes" ${ws_root} + + # Core CI test package dependency # Policy 3 + ${pkgs}= Stuart pr evaluation ${core_ci_file} MdePkg,MdeModulePkg,ArmVirtPkg ${master_branch} ${EMPTY} ${ws_root} + Confirm same contents ${pkgs} ArmVirtPkg + + [Teardown] Delete branch ${branch_name} ${master_branch} ${ws_root} + +Test Stuart PR for Policy 4 module c file changed that platform dsc depends on + [Tags] PrEval Edk2 + + ${branch_name}= Set Variable PR_Rand_${{random.randint(0, 10000)}} + ${file_to_modify}= Set Variable MdeModulePkg${/}Core${/}Dxe${/}DxeMain.h + + Reset git repo to main branch ${ws_root} ${master_branch} + Make new branch ${branch_name} ${ws_root} + + Append To File ${ws_root}${/}${file_to_modify} + ... Hello World!! Making a change for fun. + + Stage changed file ${file_to_modify} ${ws_root} + Commit changes "Changes" ${ws_root} + + # Platform CI test DSC dependnency on implementation file # Policy 4 + ${pkgs}= Stuart pr evaluation ${platform_ci_file} OvmfPkg ${master_branch} ${EMPTY} ${ws_root} + Confirm same contents ${pkgs} OvmfPkg + + [Teardown] Delete branch ${branch_name} ${master_branch} ${ws_root} + +Test Stuart PR for Policy 4 module c file changed that platform dsc does not depend on + [Tags] PrEval Edk2 + + ${branch_name}= Set Variable PR_Rand_${{random.randint(0, 10000)}} + ${file_to_modify}= Set Variable MdeModulePkg${/}Application${/}HelloWorld${/}HelloWorld.c + + Reset git repo to main branch ${ws_root} ${master_branch} + Make new branch ${branch_name} ${ws_root} + + Append To File ${ws_root}${/}${file_to_modify} + ... Hello World!! Making a change for fun. + + Stage changed file ${file_to_modify} ${ws_root} + Commit changes "Changes" ${ws_root} + + # Platform CI test DSC dependnency on implementation file # Policy 4 + ${pkgs}= Stuart pr evaluation ${platform_ci_file} OvmfPkg ${master_branch} ${EMPTY} ${ws_root} + Should Be Empty ${pkgs} + + [Teardown] Delete branch ${branch_name} ${master_branch} ${ws_root} + +Test Stuart PR for all policies when a PR contains a deleted file + [Tags] PrEval Delete Edk2 + + ${branch_name}= Set Variable PR_Rand_${{random.randint(0, 10000)}} + ${file_to_modify}= Set Variable MdeModulePkg${/}Application${/}HelloWorld${/}HelloWorld.c + + Reset git repo to main branch ${ws_root} ${master_branch} + Make new branch ${branch_name} ${ws_root} + + Remove File ${ws_root}${/}${file_to_modify} + + Stage changed file ${file_to_modify} ${ws_root} + Commit changes "Changes" ${ws_root} + + # Platform CI test DSC dependnency on implementation file # Policy 4 + ${pkgs}= Stuart pr evaluation ${platform_ci_file} OvmfPkg ${master_branch} ${EMPTY} ${ws_root} + Should Be Empty ${pkgs} + + [Teardown] Delete branch ${branch_name} ${master_branch} ${ws_root} + +Test Stuart PR for all policies when a PR contains a deleted folder + [Tags] PrEval Delete Edk2 + + ${branch_name}= Set Variable PR_Rand_${{random.randint(0, 10000)}} + ${file_to_modify}= Set Variable MdeModulePkg${/}Application${/}HelloWorld + + Reset git repo to main branch ${ws_root} ${master_branch} + Make new branch ${branch_name} ${ws_root} + + Remove Directory ${ws_root}${/}${file_to_modify} True + + Stage changed file ${file_to_modify} ${ws_root} + Commit changes "Changes" ${ws_root} + + # Platform CI test DSC dependnency on implementation file # Policy 4 + ${pkgs}= Stuart pr evaluation ${platform_ci_file} OvmfPkg ${master_branch} ${EMPTY} ${ws_root} + Should Be Empty ${pkgs} + + [Teardown] Delete branch ${branch_name} ${master_branch} ${ws_root} + +Test Stuart PR for all policies when a PR contains multiple levels of deleted folders + [Tags] PrEval Delete Edk2 + + ${branch_name}= Set Variable PR_Rand_${{random.randint(0, 10000)}} + ${file_to_modify}= Set Variable UefiCpuPkg${/}CpuDxe + + Reset git repo to main branch ${ws_root} ${master_branch} + Make new branch ${branch_name} ${ws_root} + + Remove Directory ${ws_root}${/}${file_to_modify} True + + Stage changed file ${file_to_modify} ${ws_root} + Commit changes "Changes" ${ws_root} + + # Platform CI test DSC dependnency on implementation file # Policy 4 + ${pkgs}= Stuart pr evaluation ${platform_ci_file} OvmfPkg ${master_branch} ${EMPTY} ${ws_root} + Confirm same contents ${pkgs} OvmfPkg + + [Teardown] Delete branch ${branch_name} ${master_branch} ${ws_root} + +Test Stuart PR for all policies when a PR contains file added + [Tags] PrEval Add Edk2 + + ${branch_name}= Set Variable PR_Rand_${{random.randint(0, 10000)}} + ${file_to_move}= Set Variable MdePkg${/}Library${/}BaseS3StallLib${/}S3StallLib.c + ${location_to_move}= Set Variable MdePkg${/}Library${/}BaseLib + + Reset git repo to main branch ${ws_root} ${master_branch} + Make new branch ${branch_name} ${ws_root} + + Move File ${ws_root}${/}${file_to_move} ${ws_root}${/}${location_to_move} + + Stage changed file ${location_to_move} ${ws_root} + Commit changes "Changes" ${ws_root} + + # Platform CI test DSC dependnency on implementation file # Policy 4 + ${pkgs}= Stuart pr evaluation ${platform_ci_file} OvmfPkg ${master_branch} ${EMPTY} ${ws_root} + Confirm same contents ${pkgs} OvmfPkg + + [Teardown] Delete branch ${branch_name} ${master_branch} ${ws_root} + +Test Stuart PR for all policies when a PR contains directory added + [Tags] PrEval Add Edk2 + + ${branch_name}= Set Variable PR_Rand_${{random.randint(0, 10000)}} + ${file_to_move}= Set Variable MdePkg${/}Library${/}BaseS3StallLib + ${location_to_move}= Set Variable MdeModulePkg${/}Library + + Reset git repo to main branch ${ws_root} ${master_branch} + Make new branch ${branch_name} ${ws_root} + + Move Directory ${ws_root}${/}${file_to_move} ${ws_root}${/}${location_to_move} + + Stage changed file ${location_to_move} ${ws_root} + Commit changes "Changes" ${ws_root} + + # Platform CI test DSC dependnency on implementation file # Policy 4 + ${pkgs}= Stuart pr evaluation ${platform_ci_file} OvmfPkg ${master_branch} ${EMPTY} ${ws_root} + Should Be Empty ${pkgs} + + [Teardown] Delete branch ${branch_name} ${master_branch} ${ws_root} + +Test Stuart PR for changing a file at the root of repo + [Tags] PrEval Edk2 + + ${branch_name}= Set Variable PR_Rand_${{random.randint(0, 10000)}} + ${file_to_modify}= Set Variable edksetup.bat + + Reset git repo to main branch ${ws_root} ${master_branch} + Make new branch ${branch_name} ${ws_root} + + Append To File ${ws_root}${/}${file_to_modify} + ... Hello World!! Making a change for fun. + + Stage changed file ${file_to_modify} ${ws_root} + Commit changes "Changes" ${ws_root} + + # Platform CI test DSC dependnency on implementation file # Policy 4 + ${pkgs}= Stuart pr evaluation ${platform_ci_file} OvmfPkg ${master_branch} ${EMPTY} ${ws_root} + Should Be Empty ${pkgs} + + [Teardown] Delete branch ${branch_name} ${master_branch} ${ws_root} diff --git a/integration_test/mu_core_ci.robot b/integration_test/mu_core_ci.robot new file mode 100644 index 00000000..f9a1b59c --- /dev/null +++ b/integration_test/mu_core_ci.robot @@ -0,0 +1,109 @@ +*** Settings *** +Documentation A test suite to test Core CI on edk2 repo +# +# Copyright (c), Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent + +Library Process +Library OperatingSystem +Library String + +Resource Shared_Keywords.robot + +Suite Setup One time setup ${repo_url} ${ws_dir} + +# Suite Setup + +*** Variables *** +${repo_url} https://github.com/microsoft/mu_basecore +${master_branch} release/202002 +${ws_dir} mu_basecore +${ci_file} .pytool/CISettings.py +${ws_root} ${TEST_OUTPUT}${/}${ws_dir} +${tool_chain} VS2019 + + +*** Keywords *** +One time setup + [Arguments] ${url} ${folder} + ## Dump pip versions + ${result}= Run Process python -m pip list shell=True + Log ${result.stdout} + + ## Make output directory if doesn't already exist + Create Directory ${TEST_OUTPUT} + + ## Clone repo + Run Keyword Clone the git repo ${url} ${folder} + + +*** Test Cases *** + +Run ProjectMu MdePkg CoreCI Debug + [Documentation] This Test will run X64 DEBUG build of Core CI on the MdePkg + [Tags] CoreCI Windows VS2019 Compile ProjectMu + + ${archs}= Set Variable X64 + ${targets}= Set Variable DEBUG + ${packages}= Set Variable MdePkg + + # make sure on master + Reset git repo to main branch ${ws_root} ${master_branch} + + Stuart setup ${ci_file} ${archs} ${targets} ${packages} ${tool_chain} ${ws_root} + Stuart ci setup ${ci_file} ${archs} ${targets} ${packages} ${tool_chain} ${ws_root} + Stuart update ${ci_file} ${archs} ${targets} ${packages} ${tool_chain} ${ws_root} + Build BaseTools ${tool_chain} ${ws_root} + Stuart CI build ${ci_file} ${archs} ${targets} ${packages} ${tool_chain} ${ws_root} + +Run ProjectMu SecurityPkg CoreCI Release + [Documentation] This Test will run IA32 RELEASE build of Core CI on the SecurityPkg + [Tags] CoreCI Windows VS2019 Compile ProjectMu + + ${archs}= Set Variable IA32 + ${targets}= Set Variable RELEASE + ${packages}= Set Variable SecurityPkg + + # make sure on master + Reset git repo to main branch ${ws_root} ${master_branch} + + Stuart setup ${ci_file} ${archs} ${targets} ${packages} ${tool_chain} ${ws_root} + Stuart ci setup ${ci_file} ${archs} ${targets} ${packages} ${tool_chain} ${ws_root} + Stuart update ${ci_file} ${archs} ${targets} ${packages} ${tool_chain} ${ws_root} + Build BaseTools ${tool_chain} ${ws_root} + Stuart CI build ${ci_file} ${archs} ${targets} ${packages} ${tool_chain} ${ws_root} + +Run ProjectMu UefiCpuPkg CoreCI for No-Target + [Documentation] This Test will run NO-TARGET Core CI test on the UefiCpuPkg + [Tags] CoreCI Windows VS2019 NO-TARGET ProjectMu + + ${archs}= Set Variable X64,IA32,AARCH64,ARM + ${targets}= Set Variable NO-TARGET + ${packages}= Set Variable UefiCpuPkg + + # make sure on master + Reset git repo to main branch ${ws_root} ${master_branch} + + Stuart setup ${ci_file} ${archs} ${targets} ${packages} ${tool_chain} ${ws_root} + Stuart ci setup ${ci_file} ${archs} ${targets} ${packages} ${tool_chain} ${ws_root} + Stuart update ${ci_file} ${archs} ${targets} ${packages} ${tool_chain} ${ws_root} + Build BaseTools ${tool_chain} ${ws_root} + Stuart CI build ${ci_file} ${archs} ${targets} ${packages} ${tool_chain} ${ws_root} + +Run ProjectMu MdeModulePkg CoreCI for NOOPT and HostTest + [Documentation] This Test will run NOOPT Core CI which includes Host-Tests on the MdeModulePkg + [Tags] CoreCI Windows VS2019 NOOPT HOST-TEST ProjectMu + + ${archs}= Set Variable X64 + ${targets}= Set Variable NOOPT + ${packages}= Set Variable MdeModulePkg + + # make sure on master + Reset git repo to main branch ${ws_root} ${master_branch} + + Stuart setup ${ci_file} ${archs} ${targets} ${packages} ${tool_chain} ${ws_root} + Stuart ci setup ${ci_file} ${archs} ${targets} ${packages} ${tool_chain} ${ws_root} + Stuart update ${ci_file} ${archs} ${targets} ${packages} ${tool_chain} ${ws_root} + Build BaseTools ${tool_chain} ${ws_root} + Stuart CI build ${ci_file} ${archs} ${targets} ${packages} ${tool_chain} ${ws_root} + diff --git a/integration_test/mu_stuart_pr_eval.robot b/integration_test/mu_stuart_pr_eval.robot new file mode 100644 index 00000000..355fef43 --- /dev/null +++ b/integration_test/mu_stuart_pr_eval.robot @@ -0,0 +1,281 @@ +*** Settings *** +Documentation A test suite to test Stuart Pr Eval +# +# Copyright (c), Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent + +Library Process +Library OperatingSystem +Library String + +Resource Shared_Keywords.robot + +Suite Setup One time setup ${repo_url} ${ws_dir} + +# Suite Setup + +*** Variables *** +${repo_url} https://github.com/microsoft/mu_basecore +${master_branch} release/202002 +${ws_dir} mu_basecore +${core_ci_file} .pytool/CISettings.py + +${ws_root} ${TEST_OUTPUT}${/}${ws_dir} + + +*** Keywords *** +One time setup + [Arguments] ${url} ${folder} + ## Dump pip versions + ${result}= Run Process python -m pip list shell=True + Log ${result.stdout} + + ## Make output directory if doesn't already exist + Create Directory ${TEST_OUTPUT} + + ## Clone repo + Run Keyword Clone the git repo ${url} ${folder} + + ## clean the repo of all dependencies including additional repos + ## Project Mu test cases are most useful for multi-repository testing + ## but for that to be useful the other repositories must not be + ## populated in the file system + # + # clean all files quietly to avoid robot log overflow + ${result}= Run Process git clean -qxfd -f cwd=${ws_root} + Log Many stdout: ${result.stdout} stderr: ${result.stderr} + Should Be Equal As Integers ${result.rc} 0 + +*** Test Cases *** + +Test Stuart PR using ProjectMu for Policy 1 special files in PrEvalSettingsManager + [Tags] PrEval ProjectMu + + ${branch_name}= Set Variable PR_Rand_${{random.randint(0, 10000)}} + ${file_to_modify}= Set Variable BaseTools${/}Source${/}C${/}GenFv${/}GenFv.c + + Reset git repo to main branch ${ws_root} ${master_branch} + Make new branch ${branch_name} ${ws_root} + + Append To File ${ws_root}${/}${file_to_modify} + ... Hello World!! Making a change for fun. + + Stage changed file ${file_to_modify} ${ws_root} + Commit changes "Changes" ${ws_root} + + # Core CI test package dependency # Policy 3 + ${pkgs}= Stuart pr evaluation ${core_ci_file} MdePkg,MdeModulePkg,UefiCpuPkg ${master_branch} ${EMPTY} ${ws_root} + Confirm same contents ${pkgs} MdePkg,MdeModulePkg,UefiCpuPkg + + [Teardown] Delete branch ${branch_name} ${master_branch} ${ws_root} + +Test Stuart PR using ProjectMu for Policy 2 in package change of private inf file + [Tags] PrEval ProjectMu + + ${branch_name}= Set Variable PR_Rand_${{random.randint(0, 10000)}} + ${file_to_modify}= Set Variable MdePkg${/}Library${/}BaseLib${/}BaseLib.inf + + Reset git repo to main branch ${ws_root} ${master_branch} + Make new branch ${branch_name} ${ws_root} + + Append To File ${ws_root}${/}${file_to_modify} + ... Hello World!! Making a change for fun. + + Stage changed file ${file_to_modify} ${ws_root} + Commit changes "Changes" ${ws_root} + + # Core CI test same package # policy 2 + ${pkgs}= Stuart pr evaluation ${core_ci_file} MdePkg ${master_branch} ${EMPTY} ${ws_root} + Confirm same contents ${pkgs} MdePkg + + # Core CI test another package and make sure a it doesn't need to build + ${pkgs}= Stuart pr evaluation ${core_ci_file} MdeModulePkg ${master_branch} ${EMPTY} ${ws_root} + Should Be Empty ${pkgs} + + [Teardown] Delete branch ${branch_name} ${master_branch} ${ws_root} + + +Test Stuart PR using ProjectMu for Policy 3 for package dependency on change of public header file + [Tags] PrEval ProjectMu + + ${branch_name}= Set Variable PR_Rand_${{random.randint(0, 10000)}} + ${file_to_modify}= Set Variable MdePkg${/}Include${/}Protocol${/}DevicePath.h + + Reset git repo to main branch ${ws_root} ${master_branch} + Make new branch ${branch_name} ${ws_root} + + Append To File ${ws_root}${/}${file_to_modify} + ... Hello World!! Making a change for fun. + + Stage changed file ${file_to_modify} ${ws_root} + Commit changes "Changes" ${ws_root} + + # Core CI test package dependency # Policy 3 + ${pkgs}= Stuart pr evaluation ${core_ci_file} MdeModulePkg,UefiCpuPkg ${master_branch} ${EMPTY} ${ws_root} + Confirm same contents ${pkgs} MdeModulePkg,UefiCpuPkg + + [Teardown] Delete branch ${branch_name} ${master_branch} ${ws_root} + +Test Stuart PR using ProjectMu for Policy 3 for package dependency on change of public header file not dependent + [Tags] PrEval ProjectMu + + ${branch_name}= Set Variable PR_Rand_${{random.randint(0, 10000)}} + ${file_to_modify}= Set Variable PcAtChipsetPkg${/}Include${/}Guid${/}PcAtChipsetTokenSpace.h + + Reset git repo to main branch ${ws_root} ${master_branch} + Make new branch ${branch_name} ${ws_root} + + Append To File ${ws_root}${/}${file_to_modify} + ... Hello World!! Making a change for fun. + + Stage changed file ${file_to_modify} ${ws_root} + Commit changes "Changes" ${ws_root} + + # Core CI test package dependency # Policy 3 + ${pkgs}= Stuart pr evaluation ${core_ci_file} MdePkg,MdeModulePkg,UefiCpuPkg ${master_branch} ${EMPTY} ${ws_root} + Should Be Empty ${pkgs} + + [Teardown] Delete branch ${branch_name} ${master_branch} ${ws_root} + +Test Stuart PR using ProjectMu for Policy 3 for package dependency on change of package dec file + [Tags] PrEval ProjectMu + + ${branch_name}= Set Variable PR_Rand_${{random.randint(0, 10000)}} + ${file_to_modify}= Set Variable UefiCpuPkg${/}UefiCpuPkg.dec + + Reset git repo to main branch ${ws_root} ${master_branch} + Make new branch ${branch_name} ${ws_root} + + Append To File ${ws_root}${/}${file_to_modify} + ... Hello World!! Making a change for fun. + + Stage changed file ${file_to_modify} ${ws_root} + Commit changes "Changes" ${ws_root} + + # Core CI test package dependency # Policy 3 + ${pkgs}= Stuart pr evaluation ${core_ci_file} MdePkg,MdeModulePkg,PcAtChipsetPkg ${master_branch} ${EMPTY} ${ws_root} + Confirm same contents ${pkgs} PcAtChipsetPkg + + [Teardown] Delete branch ${branch_name} ${master_branch} ${ws_root} + +Test Stuart PR using ProjectMu for all policies when a PR contains a deleted file + [Tags] PrEval Delete ProjectMu + + ${branch_name}= Set Variable PR_Rand_${{random.randint(0, 10000)}} + ${file_to_modify}= Set Variable MdeModulePkg${/}Application${/}HelloWorld${/}HelloWorld.c + + Reset git repo to main branch ${ws_root} ${master_branch} + Make new branch ${branch_name} ${ws_root} + + Remove File ${ws_root}${/}${file_to_modify} + + Stage changed file ${file_to_modify} ${ws_root} + Commit changes "Changes" ${ws_root} + + ${pkgs}= Stuart pr evaluation ${core_ci_file} MdePkg ${master_branch} ${EMPTY} ${ws_root} + Should Be Empty ${pkgs} + + [Teardown] Delete branch ${branch_name} ${master_branch} ${ws_root} + +Test Stuart PR using ProjectMu for all policies when a PR contains a deleted folder + [Tags] PrEval Delete ProjectMu + + ${branch_name}= Set Variable PR_Rand_${{random.randint(0, 10000)}} + ${file_to_modify}= Set Variable MdeModulePkg${/}Application${/}HelloWorld + + Reset git repo to main branch ${ws_root} ${master_branch} + Make new branch ${branch_name} ${ws_root} + + Remove Directory ${ws_root}${/}${file_to_modify} True + + Stage changed file ${file_to_modify} ${ws_root} + Commit changes "Changes" ${ws_root} + + # Platform CI test DSC dependnency on implementation file # Policy 4 + ${pkgs}= Stuart pr evaluation ${core_ci_file} SecurityPkg ${master_branch} ${EMPTY} ${ws_root} + Should Be Empty ${pkgs} + + [Teardown] Delete branch ${branch_name} ${master_branch} ${ws_root} + +Test Stuart PR using ProjectMu for all policies when a PR contains multiple levels of deleted folders + [Tags] PrEval Delete ProjectMu + + ${branch_name}= Set Variable PR_Rand_${{random.randint(0, 10000)}} + ${file_to_modify}= Set Variable UefiCpuPkg${/}CpuDxe + + Reset git repo to main branch ${ws_root} ${master_branch} + Make new branch ${branch_name} ${ws_root} + + Remove Directory ${ws_root}${/}${file_to_modify} True + + Stage changed file ${file_to_modify} ${ws_root} + Commit changes "Changes" ${ws_root} + + # Platform CI test DSC dependnency on implementation file # Policy 4 + ${pkgs}= Stuart pr evaluation ${core_ci_file} SecurityPkg ${master_branch} ${EMPTY} ${ws_root} + Should Be Empty ${pkgs} + + [Teardown] Delete branch ${branch_name} ${master_branch} ${ws_root} + +Test Stuart PR using ProjectMu for all policies when a PR contains file added + [Tags] PrEval Add ProjectMu + + ${branch_name}= Set Variable PR_Rand_${{random.randint(0, 10000)}} + ${file_to_move}= Set Variable MdePkg${/}Library${/}BaseS3StallLib${/}S3StallLib.c + ${location_to_move}= Set Variable MdePkg${/}Library${/}BaseLib + + Reset git repo to main branch ${ws_root} ${master_branch} + Make new branch ${branch_name} ${ws_root} + + Move File ${ws_root}${/}${file_to_move} ${ws_root}${/}${location_to_move} + + Stage changed file ${location_to_move} ${ws_root} + Commit changes "Changes" ${ws_root} + + # Platform CI test DSC dependnency on implementation file # Policy 4 + ${pkgs}= Stuart pr evaluation ${core_ci_file} MdeModulePkg ${master_branch} ${EMPTY} ${ws_root} + Should Be Empty ${pkgs} + + [Teardown] Delete branch ${branch_name} ${master_branch} ${ws_root} + +Test Stuart PR for all policies when a PR contains directory added + [Tags] PrEval Add + + ${branch_name}= Set Variable PR_Rand_${{random.randint(0, 10000)}} + ${file_to_move}= Set Variable MdePkg${/}Library${/}BaseS3StallLib + ${location_to_move}= Set Variable MdeModulePkg${/}Library + + Reset git repo to main branch ${ws_root} ${master_branch} + Make new branch ${branch_name} ${ws_root} + + Move Directory ${ws_root}${/}${file_to_move} ${ws_root}${/}${location_to_move} + + Stage changed file ${location_to_move} ${ws_root} + Commit changes "Changes" ${ws_root} + + # Platform CI test DSC dependnency on implementation file # Policy 4 + ${pkgs}= Stuart pr evaluation ${core_ci_file} UefiCpuPkg ${master_branch} ${EMPTY} ${ws_root} + Should Be Empty ${pkgs} + + [Teardown] Delete branch ${branch_name} ${master_branch} ${ws_root} + +Test Stuart PR for changing a file at the root of repo + [Tags] PrEval + + ${branch_name}= Set Variable PR_Rand_${{random.randint(0, 10000)}} + ${file_to_modify}= Set Variable edksetup.bat + + Reset git repo to main branch ${ws_root} ${master_branch} + Make new branch ${branch_name} ${ws_root} + + Append To File ${ws_root}${/}${file_to_modify} + ... Hello World!! Making a change for fun. + + Stage changed file ${file_to_modify} ${ws_root} + Commit changes "Changes" ${ws_root} + + # Platform CI test DSC dependnency on implementation file # Policy 4 + ${pkgs}= Stuart pr evaluation ${core_ci_file} MdePkg ${master_branch} ${EMPTY} ${ws_root} + Should Be Empty ${pkgs} + + [Teardown] Delete branch ${branch_name} ${master_branch} ${ws_root}