1*0f6ddb37SDavid Ostrovskyload( 2*0f6ddb37SDavid Ostrovsky "@com_googlesource_gerrit_bazlets//tools:junit.bzl", 3*0f6ddb37SDavid Ostrovsky "junit_tests", 4*0f6ddb37SDavid Ostrovsky) 5*0f6ddb37SDavid Ostrovsky 6*0f6ddb37SDavid Ostrovskydef tests(tests): 7*0f6ddb37SDavid Ostrovsky for src in tests: 8*0f6ddb37SDavid Ostrovsky name = src[len('tst/'):len(src)-len('.java')].replace('/', '_') 9*0f6ddb37SDavid Ostrovsky labels = [] 10*0f6ddb37SDavid Ostrovsky if name.startswith('org_eclipse_jgit_'): 11*0f6ddb37SDavid Ostrovsky l = name[len('org.eclipse.jgit_'):] 12*0f6ddb37SDavid Ostrovsky if l.startswith('internal_storage_'): 13*0f6ddb37SDavid Ostrovsky l = l[len('internal.storage_'):] 14*0f6ddb37SDavid Ostrovsky i = l.find('_') 15*0f6ddb37SDavid Ostrovsky if i > 0: 16*0f6ddb37SDavid Ostrovsky labels.append(l[:i]) 17*0f6ddb37SDavid Ostrovsky else: 18*0f6ddb37SDavid Ostrovsky labels.append(i) 19*0f6ddb37SDavid Ostrovsky if 'lib' not in labels: 20*0f6ddb37SDavid Ostrovsky labels.append('lib') 21*0f6ddb37SDavid Ostrovsky 22*0f6ddb37SDavid Ostrovsky additional_deps = [] 23*0f6ddb37SDavid Ostrovsky if src.endswith("RootLocaleTest.java"): 24*0f6ddb37SDavid Ostrovsky additional_deps = [ 25*0f6ddb37SDavid Ostrovsky '//org.eclipse.jgit.pgm:pgm', 26*0f6ddb37SDavid Ostrovsky '//org.eclipse.jgit.ui:ui', 27*0f6ddb37SDavid Ostrovsky ] 28*0f6ddb37SDavid Ostrovsky if src.endswith("WalkEncryptionTest.java"): 29*0f6ddb37SDavid Ostrovsky additional_deps = [ 30*0f6ddb37SDavid Ostrovsky '//org.eclipse.jgit:insecure_cipher_factory', 31*0f6ddb37SDavid Ostrovsky ] 32*0f6ddb37SDavid Ostrovsky 33*0f6ddb37SDavid Ostrovsky junit_tests( 34*0f6ddb37SDavid Ostrovsky name = name, 35*0f6ddb37SDavid Ostrovsky tags = labels, 36*0f6ddb37SDavid Ostrovsky srcs = [src], 37*0f6ddb37SDavid Ostrovsky deps = additional_deps + [ 38*0f6ddb37SDavid Ostrovsky ':helpers', 39*0f6ddb37SDavid Ostrovsky ':tst_rsrc', 40*0f6ddb37SDavid Ostrovsky '//org.eclipse.jgit:jgit', 41*0f6ddb37SDavid Ostrovsky '//org.eclipse.jgit.junit:junit', 42*0f6ddb37SDavid Ostrovsky '//org.eclipse.jgit.lfs:jgit-lfs', 43*0f6ddb37SDavid Ostrovsky '@hamcrest_core//jar', 44*0f6ddb37SDavid Ostrovsky '@hamcrest_library//jar', 45*0f6ddb37SDavid Ostrovsky '@javaewah//jar', 46*0f6ddb37SDavid Ostrovsky '@junit//jar', 47*0f6ddb37SDavid Ostrovsky '@log_api//jar', 48*0f6ddb37SDavid Ostrovsky '@slf4j_simple//jar', 49*0f6ddb37SDavid Ostrovsky ], 50*0f6ddb37SDavid Ostrovsky jvm_flags = ["-Xmx256m", "-Dfile.encoding=UTF-8"], 51*0f6ddb37SDavid Ostrovsky ) 52