Skip to content

Commit b964ad6

Browse files
Tejas ManhasTejas Manhas
Tejas Manhas
authored and
Tejas Manhas
committed
adding new functionalities for linux-next and bisect_flag
Signed-off-by: Tejas Manhas <[email protected]>
1 parent d575d90 commit b964ad6

File tree

3 files changed

+38
-12
lines changed

3 files changed

+38
-12
lines changed

OpTestConfiguration.py

+2
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,8 @@ def get_parser():
460460
help="Don't exit if we find unknown command line arguments")
461461
misc_group.add_argument("--secvar-payload-url",
462462
help="Specify a URL for the secvar test data payload")
463+
misc_group.add_argument("--bisect-flag",
464+
help="Specify if bisection is to be done or not")
463465
return parser
464466

465467

testcases/Build_bisector.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,21 @@ def runTest(self):
9191
makefile_path = os.path.join(self.conf.basedir, "make.sh")
9292
self.cv_HOST.copy_test_file_to_host(makefile_path, dstdir=self.linux_path)
9393
self.connection.run_command("git bisect start")
94-
self.connection.run_command("git bisect good {} ".format(self.good_commit))
94+
folder_type=re.split(r'[\/\\.]',str(self.repo))[-2]
95+
print("FOLDER",folder_type)
96+
if folder_type == 'linux-next':
97+
self.connection.run_command("git fetch --tags")
98+
good_tag=self.connection.run_command("git tag -l 'v[0-9]*' | sort -V | tail -n 1")
99+
self.connection.run_command("git bisect good {} ".format(good_tag))
100+
else:
101+
self.connection.run_command("git bisect good {} ".format(self.good_commit))
95102
self.connection.run_command(" git bisect bad ")
96103
self.connection.run_command("chmod +x ./make.sh ")
97104
commit = self.connection.run_command(" git bisect run ./make.sh")
98105
badCommit = [word for word in commit if word.endswith("is the first bad commit")]
99106
badCommit= badCommit[0].split()[0]
100107
email = self.get_email(badCommit)
108+
log.info("LOGGG")
109+
self.connection.run_command("git bisect log")
101110
self.connection.run_command("git bisect reset")
102111
return email , badCommit

testcases/Test_build.py

+26-11
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import configparser
3131
import sys
3232
from testcases import Build_bisector
33+
from testcases import Email_git
3334
from common.OpTestSystem import OpSystemState
3435
from common.OpTestSOL import OpSOLMonitorThread
3536
from common.Exceptions import CommandFailed
@@ -60,6 +61,7 @@ def setUp(self):
6061
self.bisect_category = self.conf.args.bisect_category
6162
self.append_kernel_cmdline = self.conf.args.append_kernel_cmdline
6263
self.linux_path = os.path.join(self.home, "linux")
64+
self.bisect_flag = self.conf.args.bisect_flag
6365
if not self.repo:
6466
self.fail("Provide git repo of kernel to install")
6567
if not (self.conf.args.host_ip and self.conf.args.host_user and self.conf.args.host_password):
@@ -92,8 +94,13 @@ def runTest(self):
9294
self.branch='master'
9395
log.info("CD DONE")
9496

95-
self.connection.run_command("git clone --depth 1 {} -b {}".format(self.repo, self.branch))
97+
self.connection.run_command("git clone -b {} {} linux".format( self.branch, self.repo),timeout=3000)
98+
# self.connection.run_command("git reset --hard ")
9699
self.connection.run_command("cd linux")
100+
# self.connection.run_command("git tag")
101+
# self.connection.run_command("git checkout next-20240229")
102+
103+
# self.connection.run_command("git reset --hard next-20240229")
97104
commit = self.connection.run_command(" git log -1 --format=%H")
98105
self.connection.run_command("cd ..")
99106
self.connection.run_command("wget http://ltc-jenkins.aus.stglabs.ibm.com:81/abdul/ioci/kernel_config -o linux/.config")
@@ -107,16 +114,24 @@ def runTest(self):
107114
if exit_code != 0:
108115
entry = self.Store_loc(errVal)[-1]
109116
badCommit = commit[-1]
110-
log.info("BUILD_BISECTOR CALLED")
111-
bisect = Build_bisector.Buil_bisector()
112-
bisect.setUp()
113-
res = bisect.runTest()
114-
log.info("BUILD_BISECTOR END")
115-
em=res[0]
116-
commiti=res[1]
117-
else :
118-
em=""
117+
if self.bisect_flag == True or self.bisect_flag == 'true':
118+
log.info("BUILD_BISECTOR CALLED")
119+
bisect = Build_bisector.Buil_bisector()
120+
bisect.setUp()
121+
res = bisect.runTest()
122+
log.info("BUILD_BISECTOR END")
123+
emaili=res[0]
124+
commiti=res[1]
125+
log.info("COMMIT REVERT HAS TO BE CHECKED MANUALLY")
126+
else :
127+
emaili=""
128+
commiti=commit[-1]
129+
else :
130+
emaili=""
119131
commiti=commit[-1]
120132
with open('output.json','w') as f:
121-
json.dump({"exit_code":exit_code,"email":em,"commit": commiti,"error":entry},f)
133+
json.dump({"exit_code":exit_code,"email":emaili,"commit": commiti,"error":entry,"flag":self.bisect_flag},f)
134+
email = Email_git.Email_git()
135+
email.setUp()
136+
res = email.runTest()
122137
return exit_code

0 commit comments

Comments
 (0)