assessing the effect of data transformations on test suite...
TRANSCRIPT
ASSESSINGTHEEFFECTOFDATATRANSFORMATIONSONTESTSUITE
COMPILATIONPanagiotisStratis,VanyaYaneva,AjithaRajan
12October2018ESEM'18,Oulu,Finland
SOFTWAREISEVERYWHERE
SAFETYANDCORRECTNESSARECRUCIALTESTINGISCRITICAL
TESTINGCANBEEXTREMELYTIMECONSUMING.
Testingframeworks:
GoogleTest(C++)JUnit(Java)Mocha(JavaScript)
...and100sothers
HOWDOWEIMPLEMENTTESTING?
Repeatthecycle:
everycommiteverymergeTest-drivendevelopment(TDD)
everyday(overnightbuilds)Continuousintegration(CI)
Testingtakesasignificantportionofthedevelopmenttime.
WHENDOWETEST?
Allthetime!
1. Write/generatetests-✔Automatedtestgeneration,paralleltestgeneration
2. Build(compile)-?
3. Runtests-✔Testsuiteminimisation,testcaseprioritisation,paralleltestexecution
SPEEDINGUPTESTINGEXISTINGRESEARCH
REDUCINGCOMPILATIONTIMEISIMPORTANT
Largetestsuitestakealongtimetocompile."...Comparabletorunningtime."[CodeplaySoftware]Weneedtocompilenotonlythesystemcode,butalsothetestcode.
Compileroptimisationsincreasecompilationtime.-O1,-O2,-O3
Testcodeneedstobecompiledoften.
CONTRIBUTIONS
Codetransformationstargetingtestcode,resultinginshortercompilationtimes.
Empiricalevaluationusing15programsfromEEMBC&SPECand1largeindustryprogram.
Speedupincompilationtime:1.3xto69x.
ContainsmanyfunctioncallstotheFUT-oneforeachtestinput.
Highcompilationoverheadforfunctioninliningandinstructionselection.
Thisnumbergrowsasmoretestsareadded.
OURAPPROACH-EXAMPLE
ContainsmanyfunctioncallstotheFUT-oneforeachtestinput.
Highcompilationoverheadforfunctioninliningandinstructionselection.
Thisnumbergrowsasmoretestsareadded.
Hypothesis:ReducingthenumberofcallstotheFUT,atcompiletime,willreducecompilationtime.
OURAPPROACH-EXAMPLE
EVALUATION-RESEARCHQUESTIONS
RQ1:CompilationspeedupDoesthetransformationspeedupcompilationtime?
RQ2:ScalabilityDoesthetransformationallowustocompilelargertestsuites?
RQ3:ExecutiontimeandcorrectnessoftestingDoesthetransformationimpacttheexecutiontimeandcorrectnessoftesting?
EVALUATION-SUBJECTS
EEMBCindustry-standardembeddedsystemsapplicationsused5telecomprograms&5automotiveprograms
SPECwell-knownbenchmarkssuiteofcomputeintensiveapplicationsused5programs,includingbzip2,libquantum
Tests:10KrandomlygeneratedtestinputsCompilers:gcc,clang
ComputeCPP,CodeplaySoftwareimplementationoftheSYCLheterogeneousprogrammingmodel
Tests:2testsuites-imageTS&bufferTSeachhasapprox.10Ktests,producedbyCodeplaydevelopers
Compilers:2customcompilers,basedonClangoneforhost&onefordevice
EVALUATION-SUBJECTS
-ftime-report:showstimespentcompilingindividualfilesandfunctions.
Comparedtimetocompiletestcodevswholecode.
SPEEDUPVARIATIONACROSSPROGRAMS
SPEEDUPVARIATIONACROSSPROGRAMS
Averagecompilationtimeoftestcodeaspercentageoftotalcompilationtime.
Usingmodulardesignwithpre-compiledlibrariesgreatlyimprovesspeedup.
SPEEDUPANALYSISForEEMBCandSPEC,
Analysedassemblycodegeneratedbythecompiler.Analysedtimespentbyeachcompilerpass,using-ftime-report.
SPEEDUPANALYSIS
Beforetransformation:
SeparatecallstotheFUTemittedforeachtest.
47%oftestcodecompilationspentininstructionselectionfunctioninliningcombineredundantinstructions
Aftertransformation:
1calltotheFUTemitted.
Only13.6%ofcompilationtimespentinthosepasses.
ForEEMBCandSPEC,
Analysedassemblycodegeneratedbythecompiler.Analysedtimespentbyeachcompilerpass,using-ftime-report.
Maxspeedup69.5x(avg.42x)
Orig.time[s] Newtime[s]
bufferTS 257 4
imageTS 434 29
RQ1.SPEEDUP-COMPUTECPP
RQ2.SCALABILITY
Beforetransformation:
Clangandgcccrashwhen1milliontestsarereached.
Aftertransformation:
Clangandgccsuccessfullycompile10milliontests.
ForEEMBCandSPEC,
wegenerated10millionrandomtestinputs.
forhighestoptimisationlevel-O3.
RQ3.EXECUTIONTIMEANDCORRECTNESS
ForEEMBC,SPECandComputeCpp,
ExecutiontimeOurtransformationdoesnotslowdowntheexecutionofthetestcode.
CorrectnessOurtransformationpreservesthecorrectnessofthetestexecution.