Regression Test Selection (RTS) toolchain enabling - shijunjing/edk2 GitHub Wiki
Create build time toolchain to support Regression Test Selection (RTS)
Working branch: https://github.com/shijunjing/edk2/tree/RTS
- CLANGRTS ToolChain, to build all modules’ LLVM IR bitcode
jshi19@ub2-uefi-b01:~/wksp_efi/edk2-fork4$ build -p OvmfPkg/OvmfPkgIa32X64.dsc -a IA32 -a X64 -t CLANGRTS -b DEBUG
- LLVM IR reducer tool, to reduce the module IR basing on test case executed functions list
- Build the test case minimal equivalent code set on base version code, use the API list CpuEnableInterrupt,CpuDisableInterrupt,CpuGetInterruptState
jshi19@ub2-uefi-b01:~/wksp_efi/edk2-fork4$ opt -internalize -globaldce Build/Ovmf3264/DEBUG_CLANGRTS/X64/UefiCpuPkg/CpuDxe/CpuDxe/DEBUG/CpuDxe.dll.NoOpt.bc -internalize-public-api-list=CpuEnableInterrupt,CpuDisableInterrupt,CpuGetInterruptState -o Build/Ovmf3264/DEBUG_CLANGRTS/X64/UefiCpuPkg/CpuDxe/CpuDxe/DEBUG/CpuDxe.dll.InterruptTC.base.bc
- Do some non-logical code change, like change the function order, change the local variable names, remove/add comments, new code stype.
- Build the test case base minimal equivalent code set on new version 1 code
jshi19@ub2-uefi-b01:~/wksp_efi/edk2-fork4$ opt -internalize -globaldce Build/Ovmf3264/DEBUG_CLANGRTS/X64/UefiCpuPkg/CpuDxe/CpuDxe/DEBUG/CpuDxe.dll.NoOpt.bc -internalize-public-api-list=CpuEnableInterrupt,CpuDisableInterrupt,CpuGetInterruptState -o Build/Ovmf3264/DEBUG_CLANGRTS/X64/UefiCpuPkg/CpuDxe/CpuDxe/DEBUG/CpuDxe.dll.InterruptTC.new1.bc
- LLVM IR comparing tool, to compare the old and new version modules IR logic equivalence
jshi19@ub2-uefi-b01:~/wksp_efi/edk2-fork4$ llvm-diff Build/Ovmf3264/DEBUG_CLANGRTS/X64/UefiCpuPkg/CpuDxe/CpuDxe/DEBUG/CpuDxe.dll.InterruptTC.new1.bc Build/Ovmf3264/DEBUG_CLANGRTS/X64/UefiCpuPkg/CpuDxe/CpuDxe/DEBUG/CpuDxe.dll.InterruptTC.base.bc
- Do some logical code change, like change the constant values
- Build the new version 2 code module IR
jshi19@ub2-uefi-b01:~/wksp_efi/edk2-fork4$ build -p OvmfPkg/OvmfPkgIa32X64.dsc -a IA32 -a X64 -t CLANGRTS -b DEBUG -m UefiCpuPkg/CpuDxe/CpuDxe.inf
- Build the test case base minimal equivalent code set on new version 2 code
jshi19@ub2-uefi-b01:~/wksp_efi/edk2-fork4$ opt -internalize -globaldce Build/Ovmf3264/DEBUG_CLANGRTS/X64/UefiCpuPkg/CpuDxe/CpuDxe/DEBUG/CpuDxe.dll.NoOpt.bc -internalize-public-api-list=CpuEnableInterrupt,CpuDisableInterrupt,CpuGetInterruptState -o Build/Ovmf3264/DEBUG_CLANGRTS/X64/UefiCpuPkg/CpuDxe/CpuDxe/DEBUG/CpuDxe.dll.InterruptTC.new2.bc
- Compare the base and new version TC minimal equivalence code set
jshi19@ub2-uefi-b01:~/wksp_efi/edk2-fork4$ llvm-diff Build/Ovmf3264/DEBUG_CLANGRTS/X64/UefiCpuPkg/CpuDxe/CpuDxe/DEBUG/CpuDxe.dll.InterruptTC.new2.bc Build/Ovmf3264/DEBUG_CLANGRTS/X64/UefiCpuPkg/CpuDxe/CpuDxe/DEBUG/CpuDxe.dll.InterruptTC.base.bc
in function CpuDisableInterrupt:
in block %1 / %1:
> store i8 0, i8* @InterruptState, align 1, !dbg !4609
< store i8 1, i8* @InterruptState, align 1, !dbg !4609