10f6ddb37SDavid Ostrovskyload( 20f6ddb37SDavid Ostrovsky "@com_googlesource_gerrit_bazlets//tools:junit.bzl", 30f6ddb37SDavid Ostrovsky "junit_tests", 40f6ddb37SDavid Ostrovsky) 50f6ddb37SDavid Ostrovsky 60f6ddb37SDavid Ostrovskydef tests(tests): 70f6ddb37SDavid Ostrovsky for src in tests: 8*487571e6SDavid Pursehouse name = src[len("tst/"):len(src) - len(".java")].replace("/", "_") 90f6ddb37SDavid Ostrovsky labels = [] 10*487571e6SDavid Pursehouse if name.startswith("org_eclipse_jgit_"): 11*487571e6SDavid Pursehouse l = name[len("org.eclipse.jgit_"):] 12*487571e6SDavid Pursehouse if l.startswith("internal_storage_"): 13*487571e6SDavid Pursehouse l = l[len("internal.storage_"):] 14*487571e6SDavid Pursehouse i = l.find("_") 150f6ddb37SDavid Ostrovsky if i > 0: 160f6ddb37SDavid Ostrovsky labels.append(l[:i]) 170f6ddb37SDavid Ostrovsky else: 180f6ddb37SDavid Ostrovsky labels.append(i) 19*487571e6SDavid Pursehouse if "lib" not in labels: 20*487571e6SDavid Pursehouse labels.append("lib") 210f6ddb37SDavid Ostrovsky 220f6ddb37SDavid Ostrovsky additional_deps = [] 230f6ddb37SDavid Ostrovsky if src.endswith("RootLocaleTest.java"): 240f6ddb37SDavid Ostrovsky additional_deps = [ 25*487571e6SDavid Pursehouse "//org.eclipse.jgit.pgm:pgm", 26*487571e6SDavid Pursehouse "//org.eclipse.jgit.ui:ui", 270f6ddb37SDavid Ostrovsky ] 280f6ddb37SDavid Ostrovsky if src.endswith("WalkEncryptionTest.java"): 290f6ddb37SDavid Ostrovsky additional_deps = [ 30*487571e6SDavid Pursehouse "//org.eclipse.jgit:insecure_cipher_factory", 310f6ddb37SDavid Ostrovsky ] 320f6ddb37SDavid Ostrovsky 330f6ddb37SDavid Ostrovsky junit_tests( 340f6ddb37SDavid Ostrovsky name = name, 350f6ddb37SDavid Ostrovsky tags = labels, 360f6ddb37SDavid Ostrovsky srcs = [src], 370f6ddb37SDavid Ostrovsky deps = additional_deps + [ 38*487571e6SDavid Pursehouse ":helpers", 39*487571e6SDavid Pursehouse ":tst_rsrc", 40*487571e6SDavid Pursehouse "//lib:javaewah", 41*487571e6SDavid Pursehouse "//lib:junit", 42*487571e6SDavid Pursehouse "//lib:slf4j-api", 43*487571e6SDavid Pursehouse "//org.eclipse.jgit:jgit", 44*487571e6SDavid Pursehouse "//org.eclipse.jgit.junit:junit", 45*487571e6SDavid Pursehouse "//org.eclipse.jgit.lfs:jgit-lfs", 460f6ddb37SDavid Ostrovsky ], 470f6ddb37SDavid Ostrovsky jvm_flags = ["-Xmx256m", "-Dfile.encoding=UTF-8"], 480f6ddb37SDavid Ostrovsky ) 49