def setUp(self): os.environ["XDG_CACHE_HOME"] = tempfile.mkdtemp(prefix="gs_cache") # setup stub linux repository os.environ["LINUX_GIT"] = tempfile.mkdtemp(prefix="gs_repo") self.repo = pygit2.init_repository(os.environ["LINUX_GIT"]) author = pygit2.Signature("Alice Author", "*****@*****.**") committer = pygit2.Signature("Cecil Committer", "*****@*****.**") tree = self.repo.TreeBuilder() k_org_canon_prefix = "git://git.kernel.org/pub/scm/linux/kernel/git/" self.mainline_repo = k_org_canon_prefix + "torvalds/linux.git" self.repo.remotes.create("origin", self.mainline_repo) self.commits = {} self.commits["mainline 0"] = self.repo.create_commit( "refs/heads/mainline", author, committer, "mainline 0\n\nlog", tree.write(), []) self.commits["mainline 1"] = self.repo.create_commit( "refs/heads/mainline", author, committer, "mainline 1\n\nlog", tree.write(), [self.commits["mainline 0"]]) self.commits["mainline 2"] = self.repo.create_commit( "refs/heads/mainline", author, committer, "mainline 2\n\nlog", tree.write(), [self.commits["mainline 1"]]) self.repo.references.create("refs/remotes/origin/master", self.commits["mainline 2"]) self.repo.checkout("refs/heads/mainline") # setup stub kernel-source content self.ks_dir = tempfile.mkdtemp(prefix="gs_ks") os.chdir(self.ks_dir) subprocess.check_call(( "git", "init", "./", ), stdout=subprocess.DEVNULL) subprocess.check_call(( "git", "config", "--add", "mergetool.git-sort.cmd", "%s $LOCAL $BASE $REMOTE $MERGED" % (os.path.join(lib.libdir(), "merge_tool.py"), ), )) subprocess.check_call(( "git", "config", "--add", "mergetool.git-sort.trustexitcode", "true", )) self.patch_dir = "patches.suse" os.mkdir(self.patch_dir)
def setUp(self): os.environ["XDG_CACHE_HOME"] = tempfile.mkdtemp(prefix="gs_cache") self.repo_dir = tempfile.mkdtemp(prefix="gs_repo") self.repo = pygit2.init_repository(self.repo_dir) author = pygit2.Signature('Alice Author', '*****@*****.**') committer = pygit2.Signature('Cecil Committer', '*****@*****.**') tree = self.repo.TreeBuilder().write() parent = [] self.commits = [] for i in range(3): subject = "commit %d" % (i, ) cid = self.repo.create_commit("refs/heads/master", author, committer, "%s\n\nlog" % (subject, ), tree, parent) parent = [cid] self.commits.append(str(cid)) self.index = git_sort.SortIndex(self.repo)
def setUp(self): os.environ["XDG_CACHE_HOME"] = tempfile.mkdtemp(prefix="gs_cache") self.repo_dir = tempfile.mkdtemp(prefix="gs_repo") self.repo = pygit2.init_repository(self.repo_dir) author = pygit2.Signature('Alice Author', '*****@*****.**') committer = pygit2.Signature('Cecil Committer', '*****@*****.**') tree = self.repo.TreeBuilder().write() self.commits = [] m0 = self.repo.create_commit("refs/heads/mainline", author, committer, "mainline 0\n\nlog", tree, []) self.commits.append(self.repo.get(m0)) self.repo.create_reference_direct("refs/tags/v4.8", m0, False) self.repo.create_tag("v4.9", m0, pygit2.GIT_REF_OID, committer, "Linux 4.9") n0 = self.repo.create_commit("refs/heads/net", author, committer, "net 0\n\nlog", tree, [m0]) self.commits.append(self.repo.get(n0)) self.repo.checkout("refs/heads/mainline") m1 = self.repo.create_commit("refs/heads/mainline", author, committer, "mainline 1, merge net\n\nlog", tree, [m0, n0]) self.repo.create_tag("v4.10", m1, pygit2.GIT_REF_OID, committer, "Linux 4.10") self.repo.remotes.create( "origin", "git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git") self.repo.references.create("refs/remotes/origin/master", m1) self.repo.remotes.create( "net", "git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git") self.repo.references.create("refs/remotes/net/master", n0) self.heads = {"mainline": str(m1), "net": str(n0)} self.index = git_sort.SortIndex(self.repo)
def setUp(self): os.environ["XDG_CACHE_HOME"] = tempfile.mkdtemp(prefix="gs_cache") # setup stub linux repository os.environ["LINUX_GIT"] = tempfile.mkdtemp(prefix="gs_repo") self.repo = pygit2.init_repository(os.environ["LINUX_GIT"]) author = pygit2.Signature('Alice Author', '*****@*****.**') committer = pygit2.Signature('Cecil Committer', '*****@*****.**') tree = self.repo.TreeBuilder().write() parent = [] commits = [] for i in range(3): subject = "mainline %d" % (i, ) cid = self.repo.create_commit("refs/heads/master", author, committer, "%s\n\nlog" % (subject, ), tree, parent) parent = [cid] commits.append(cid) self.commits = commits self.repo.remotes.create( "origin", "git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git") self.repo.references.create("refs/remotes/origin/master", commits[-1]) self.index = git_sort.SortIndex(self.repo) # setup stub kernel-source content self.ks_dir = tempfile.mkdtemp(prefix="gs_ks") patch_dir = os.path.join(self.ks_dir, "patches.suse") os.mkdir(patch_dir) os.chdir(patch_dir) for commit in commits: tests.support.format_patch(self.repo.get(commit), mainline="v3.45-rc6")
def setUp(self): self.maxDiff = None self.ss_path = os.path.join(lib.libdir(), "series_sort.py") os.environ["XDG_CACHE_HOME"] = tempfile.mkdtemp(prefix="gs_cache") # setup stub linux repository os.environ["LINUX_GIT"] = tempfile.mkdtemp(prefix="gs_repo") self.repo = pygit2.init_repository(os.environ["LINUX_GIT"]) author = pygit2.Signature("Alice Author", "*****@*****.**", time=0, offset=0) committer = pygit2.Signature("Cecil Committer", "*****@*****.**", time=0, offset=0) tree = self.repo.TreeBuilder() k_org_canon_prefix = "git://git.kernel.org/pub/scm/linux/kernel/git/" self.mainline_repo = k_org_canon_prefix + "torvalds/linux.git" self.repo.remotes.create("origin", self.mainline_repo) self.net_next_repo = k_org_canon_prefix + "davem/net-next.git" self.repo.remotes.create("net-next", self.net_next_repo) self.net_repo = k_org_canon_prefix + "davem/net.git" self.rdma_repo = k_org_canon_prefix + "rdma/rdma.git" self.repo.remotes.create("rdma", self.rdma_repo) self.dledford_repo = k_org_canon_prefix + "dledford/rdma.git" self.repo.remotes.create("dledford/rdma", self.dledford_repo) self.nf_repo = k_org_canon_prefix + "pablo/nf.git" self.repo.remotes.create("pablo/nf", self.nf_repo) self.commits = {} self.commits["mainline 0"] = self.repo.create_commit( "refs/heads/mainline", author, committer, "mainline 0\n\nlog", tree.write(), []) self.commits["net-next 0"] = self.repo.create_commit( "refs/heads/net-next", author, committer, "net-next 0\n\nlog", tree.write(), [self.commits["mainline 0"]]) self.repo.references.create("refs/remotes/net-next/master", self.commits["net-next 0"]) self.commits["other 0"] = self.repo.create_commit( "refs/heads/other", author, committer, "other 0\n\nlog", tree.write(), [self.commits["mainline 0"]]) self.commits["rdma for-next 0"] = self.repo.create_commit( "refs/heads/rdma-next", author, committer, "rdma for-next 0\n\nlog", tree.write(), [self.commits["mainline 0"]]) self.commits["mainline 1"] = self.repo.create_commit( "refs/heads/mainline", author, committer, "mainline 1, merge rdma\n\nlog", tree.write(), [self.commits["mainline 0"], self.commits["rdma for-next 0"]]) self.commits["dledford/rdma k.o/for-next 0"] = self.repo.create_commit( "refs/heads/dledford-next", author, committer, "dledford/rdma k.o/for-next 0\n\nlog", tree.write(), [self.commits["rdma for-next 0"]]) self.repo.references.create( "refs/remotes/dledford/rdma/k.o/for-next", self.commits["dledford/rdma k.o/for-next 0"]) self.repo.references.create( "refs/remotes/rdma/for-next", self.commits["dledford/rdma k.o/for-next 0"]) self.repo.references.create( "refs/remotes/rdma/for-rc", self.commits["dledford/rdma k.o/for-next 0"]) self.commits["net 0"] = self.repo.create_commit( "refs/heads/net", author, committer, "net 0\n\nlog", tree.write(), [self.commits["mainline 0"]]) self.commits["nf 0"] = self.repo.create_commit( "refs/heads/nf", author, committer, "nf 0\n\nlog", tree.write(), [self.commits["mainline 0"]]) self.repo.references.create("refs/remotes/pablo/nf/master", self.commits["nf 0"]) self.commits["mainline 2"] = self.repo.create_commit( "refs/heads/mainline", author, committer, "mainline 2, merge net\n\nlog", tree.write(), [self.commits["mainline 1"], self.commits["net 0"]]) self.commits["net 1"] = self.repo.create_commit( "refs/heads/net", author, committer, "net 1\n\nlog", tree.write(), [self.commits["net 0"]]) tree.insert("README", self.repo.create_blob("NAME = v4.1 release\n"), pygit2.GIT_FILEMODE_BLOB) self.commits["v4.1"] = self.repo.create_commit( "refs/heads/mainline", author, committer, "Linux 4.1", tree.write(), [self.commits["mainline 2"]]) self.repo.references.create("refs/remotes/origin/master", self.commits["v4.1"]) self.repo.create_tag("v4.1", self.commits["v4.1"], pygit2.GIT_REF_OID, committer, "Linux 4.1") self.repo.checkout("refs/heads/mainline") # setup stub kernel-source content self.ks_dir = tempfile.mkdtemp(prefix="gs_ks") os.chdir(self.ks_dir) self.patch_dir = "patches.suse" os.mkdir(self.patch_dir)
def setUp(self): self.ss_path = os.path.join(lib.libdir(), "series_sort.py") os.environ["XDG_CACHE_HOME"] = tempfile.mkdtemp(prefix="gs_cache") # setup stub linux repository os.environ["LINUX_GIT"] = tempfile.mkdtemp(prefix="gs_repo") self.repo = pygit2.init_repository(os.environ["LINUX_GIT"]) author = pygit2.Signature('Alice Author', '*****@*****.**') committer = pygit2.Signature('Cecil Committer', '*****@*****.**') tree = self.repo.TreeBuilder().write() m0 = self.repo.create_commit("refs/heads/mainline", author, committer, "mainline 0\n\nlog", tree, []) n0 = self.repo.create_commit("refs/heads/net", author, committer, "net 0\n\nlog", tree, [m0]) self.repo.checkout("refs/heads/mainline") m1 = self.repo.create_commit("refs/heads/mainline", author, committer, "mainline 1, merge net\n\nlog", tree, [m0, n0]) m2 = self.repo.create_commit("refs/heads/mainline", author, committer, "mainline 2\n\nlog", tree, [m1]) n1 = self.repo.create_commit("refs/heads/net", author, committer, "net 1\n\nlog", tree, [n0]) n2 = self.repo.create_commit("refs/heads/net", author, committer, "net 2\n\nlog", tree, [n1]) oot0 = self.repo.create_commit("refs/heads/oot", author, committer, "oot 0\n\nlog", tree, [m0]) oot1 = self.repo.create_commit("refs/heads/oot", author, committer, "oot 1\n\nlog", tree, [oot0]) k_org_canon_prefix = "git://git.kernel.org/pub/scm/linux/kernel/git/" origin_repo = k_org_canon_prefix + "torvalds/linux.git" self.repo.remotes.create("origin", origin_repo) self.repo.references.create("refs/remotes/origin/master", m2) net_repo = k_org_canon_prefix + "davem/net.git" self.repo.remotes.create("net", net_repo) self.repo.references.create("refs/remotes/net/master", n2) self.index = git_sort.SortIndex(self.repo) # setup stub kernel-source content self.ks_dir = tempfile.mkdtemp(prefix="gs_ks") patch_dir = os.path.join(self.ks_dir, "patches.suse") os.mkdir(patch_dir) os.chdir(patch_dir) tests.support.format_patch(self.repo.get(m0), mainline="v3.45-rc6") tests.support.format_patch(self.repo.get(n0), mainline="v3.45-rc6") tests.support.format_patch(self.repo.get(n1), repo=net_repo) tests.support.format_patch(self.repo.get(n2), repo=net_repo) tests.support.format_patch(self.repo.get(oot0)) tests.support.format_patch( self.repo.get(oot1), mainline="Submitted http://lore.kernel.org/somelist/somemessage") os.chdir(self.ks_dir)
def setUp(self): os.environ["XDG_CACHE_HOME"] = tempfile.mkdtemp(prefix="gs_cache") # setup stub linux repository os.environ["LINUX_GIT"] = tempfile.mkdtemp(prefix="gs_repo") self.repo = pygit2.init_repository(os.environ["LINUX_GIT"]) self.repo.config["user.email"] = "*****@*****.**" self.repo.config["user.name"] = "Author One" author = pygit2.Signature("Author One", "*****@*****.**") committer = pygit2.Signature("Maintainer One", "*****@*****.**") tree = self.repo.TreeBuilder() tree.insert("driver.c", self.repo.create_blob("#include <bad.h>\n"), pygit2.GIT_FILEMODE_BLOB) self.commits = [] self.commits.append( self.repo.create_commit( "refs/heads/mainline", author, committer, """Add a very small module ... which was not tested. Signed-off-by: Author One <*****@*****.**> Signed-off-by: Maintainer One <*****@*****.**> """, tree.write(), [])) tree.insert("driver.c", self.repo.create_blob("#include <linux/module.h>\n"), pygit2.GIT_FILEMODE_BLOB) self.commits.append( self.repo.create_commit( "refs/heads/mainline", author, committer, """Fix the very small module syzbot is reporting deadlocks at __blkdev_get() [1]. ---------------------------------------- [ 92.493919] systemd-udevd D12696 525 1 0x00000000 [ 92.495891] Call Trace: [ 92.501560] schedule+0x23/0x80 [ 92.502923] schedule_preempt_disabled+0x5/0x10 [ 92.504645] __mutex_lock+0x416/0x9e0 [ 92.510760] __blkdev_get+0x73/0x4f0 [ 92.512220] blkdev_get+0x12e/0x390 [ 92.518151] do_dentry_open+0x1c3/0x2f0 [ 92.519815] path_openat+0x5d9/0xdc0 [ 92.521437] do_filp_open+0x7d/0xf0 [ 92.527365] do_sys_open+0x1b8/0x250 [ 92.528831] do_syscall_64+0x6e/0x270 [ 92.530341] entry_SYSCALL_64_after_hwframe+0x42/0xb7 [ 92.931922] 1 lock held by systemd-udevd/525: [ 92.933642] #0: 00000000a2849e25 (&bdev->bd_mutex){+.+.}, at: __blkdev_get+0x73/0x4f0 ---------------------------------------- The reason of deadlock turned out that wait_event_interruptible() in Reported-by: Markus Trippelsdorf <*****@*****.**> Fixes: %s ("Add a very small module") Signed-off-by: Author One <*****@*****.**> Signed-off-by: Maintainer One <*****@*****.**> """ % (str(self.commits[-1], )), tree.write(), [self.commits[-1]])) self.repo.create_tag("v4.10-rc6", self.commits[-1], pygit2.GIT_REF_OID, committer, "Linux 4.10-rc6") self.repo.remotes.create( "origin", "git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git") self.repo.references.create("refs/remotes/origin/master", self.commits[-1]) # setup stub kernel-source content self.ks_dir = tempfile.mkdtemp(prefix="gs_ks") patch_dir = os.path.join(self.ks_dir, "patches.suse") os.mkdir(patch_dir) os.chdir(patch_dir) with open(os.path.join(self.ks_dir, "series.conf"), mode="w") as f: f.write("""# Kernel patches configuration file ######################################################## # sorted patches ######################################################## """) f.write("\tpatches.suse/%s\n" % (tests.support.format_patch(self.repo.get(self.commits[0]), mainline="v4.9", references="bsc#123"), )) f.write(""" ######################################################## # end of sorted patches ######################################################## """) ss_path = os.path.join(lib.libdir(), "series_sort.py") os.chdir(self.ks_dir) # This overlaps what is tested by test_series_sort, hence, not put in a # test of its own. subprocess.check_call([ss_path, "-c", "series.conf"]) with open("series.conf") as f: content1 = f.read() subprocess.check_call([ss_path, "series.conf"]) with open("series.conf") as f: content2 = f.read() self.assertEqual(content2, content1) os.makedirs("tmp/current") os.chdir("tmp/current") subprocess.check_call( ["quilt", "setup", "--sourcedir", "../../", "../../series.conf"])
def setUp(self): os.environ["XDG_CACHE_HOME"] = tempfile.mkdtemp(prefix="gs_cache") # setup stub linux repository os.environ["LINUX_GIT"] = tempfile.mkdtemp(prefix="gs_repo") self.repo = pygit2.init_repository(os.environ["LINUX_GIT"]) self.repo.config["user.email"] = "*****@*****.**" self.repo.config["user.name"] = "Alexander Graf" author = pygit2.Signature("Alice Author", "*****@*****.**") committer = pygit2.Signature("Cecil Committer", "*****@*****.**") tree = self.repo.TreeBuilder() tree.insert("README", self.repo.create_blob("NAME = Roaring Lionus\n"), pygit2.GIT_FILEMODE_BLOB) self.commits = [] self.commits.append( self.repo.create_commit("refs/heads/mainline", author, committer, "Linux 4.9", tree.write(), [])) self.repo.create_tag("v4.9", self.commits[-1], pygit2.GIT_REF_OID, committer, "Linux 4.9") tree.insert("README", self.repo.create_blob("NAME = Anniversary Edition\n"), pygit2.GIT_FILEMODE_BLOB) self.commits.append( self.repo.create_commit("refs/heads/mainline", author, committer, "Linux 4.10-rc5", tree.write(), [self.commits[-1]])) self.repo.create_tag("v4.10-rc5", self.commits[-1], pygit2.GIT_REF_OID, committer, "Linux 4.10-rc5") tree.insert("driver.c", self.repo.create_blob("#include <linux/module.h>\n"), pygit2.GIT_FILEMODE_BLOB) author2 = pygit2.Signature("Marc Zyngier", "*****@*****.**") self.commits.append( self.repo.create_commit( "refs/heads/mainline", author2, author2, """KVM: arm/arm64: vgic-v3: Add accessors for the ICH_APxRn_EL2 registers As we're about to access the Active Priority registers a lot more, let's define accessors that take the register number as a parameter. Tested-by: Alexander Graf <*****@*****.**> Acked-by: David Daney <*****@*****.**> Reviewed-by: Eric Auger <*****@*****.**> Signed-off-by: Marc Zyngier <*****@*****.**> Signed-off-by: Christoffer Dall <*****@*****.**> """, tree.write(), [self.commits[-1]])) tree.insert("core.c", self.repo.create_blob("#include <linux/kernel.h>\n"), pygit2.GIT_FILEMODE_BLOB) author3 = pygit2.Signature("Peter Zijlstra", "*****@*****.**") self.commits.append( self.repo.create_commit( "refs/heads/mainline", author3, author3, """sched/debug: Ignore TASK_IDLE for SysRq-W Markus reported that tasks in TASK_IDLE state are reported by SysRq-W, which results in undesirable clutter. Reported-by: Markus Trippelsdorf <*****@*****.**> Signed-off-by: Peter Zijlstra (Intel) <*****@*****.**> Cc: Linus Torvalds <*****@*****.**> Cc: Peter Zijlstra <*****@*****.**> Cc: Thomas Gleixner <*****@*****.**> Cc: [email protected] Signed-off-by: Ingo Molnar <*****@*****.**> """, tree.write(), [self.commits[-1]])) tree.insert("README", self.repo.create_blob("NAME = Fearless Coyote\n"), pygit2.GIT_FILEMODE_BLOB) self.commits.append( self.repo.create_commit("refs/heads/mainline", author, committer, "Linux 4.10-rc6", tree.write(), [self.commits[-1]])) self.repo.create_tag("v4.10-rc6", self.commits[-1], pygit2.GIT_REF_OID, committer, "Linux 4.10-rc6") self.repo.remotes.create( "origin", "git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git") self.repo.references.create("refs/remotes/origin/master", self.commits[-1]) # setup stub kernel-source content self.ks_dir = tempfile.mkdtemp(prefix="gs_ks") patch_dir = os.path.join(self.ks_dir, "patches.suse") os.mkdir(patch_dir) os.chdir(patch_dir) with open(os.path.join(self.ks_dir, "series.conf"), mode="w") as f: f.write("""# Kernel patches configuration file ######################################################## # sorted patches ######################################################## """) for commit, tag in ( ( self.commits[0], "v4.9", ), ( self.commits[1], "v4.10-rc5", ), ): f.write("\tpatches.suse/%s\n" % (tests.support.format_patch( self.repo.get(commit), mainline=tag), )) f.write(""" ######################################################## # end of sorted patches ######################################################## """) ss_path = os.path.join(lib.libdir(), "series_sort.py") os.chdir(self.ks_dir) # This overlaps what is tested by test_series_sort, hence, not put in a # test of its own. subprocess.check_call([ss_path, "-c", "series.conf"]) with open("series.conf") as f: content1 = f.read() subprocess.check_call([ss_path, "series.conf"]) with open("series.conf") as f: content2 = f.read() self.assertEqual(content2, content1) subprocess.check_call(( "git", "init", "./", ), stdout=subprocess.DEVNULL) subprocess.check_call(( "git", "add", "series.conf", "patches.suse", ), stdout=subprocess.DEVNULL) subprocess.check_call(( "git", "commit", "-m", "import", ), stdout=subprocess.DEVNULL) os.makedirs("tmp/current") os.chdir("tmp/current") subprocess.check_call( ["quilt", "setup", "--sourcedir", "../../", "../../series.conf"])