<commit_before>from pysys.constants import *
from xpybuild.xpybuild_basetest import XpybuildBaseTest
import shutil

class PySysTest(XpybuildBaseTest):
	NUMBER_PATTERNS = 50
	NUMBER_TARGETS = 5 # this is just to get a more stable number
	NUMBER_FILES = 2000

	def execute(self):
		self.mkdir('findpathsroot/included')
		self.mkdir('findpathsroot/excluded')
		for i in range(self.NUMBER_FILES):
			open(self.output+'/findpathsroot/included/test%d.txt'%i,'w').close()
			open(self.output+'/findpathsroot/excluded/test%d.txt'%i,'w').close()
		
		self.xpybuild(shouldFail=False, args=['-n', 
			'NUMBER_PATTERNS=%s'%self.NUMBER_PATTERNS, 
			'NUMBER_TARGETS=%s'%self.NUMBER_TARGETS, #'--log-level=debug', #'--profile',
			])
		try:
			shutil.rmtree(self.output+'/findpathsroot')
		except Exception as e:
			self.log.info('Failed to cleanup findpathsroot: %s', e)

	def validate(self):
		self.assertGrep(file='xpybuild.out', expr="ERROR .*", contains=False)
		deps = float(self.getExprFromFile('xpybuild.log', 'dependency resolution took ([0-9.]+) s'))
		
		self.reportPerformanceResult(1000*deps/self.NUMBER_TARGETS/self.NUMBER_FILES, 'PathSet FindPaths resolution time per file with %d include patterns'%self.NUMBER_PATTERNS, 'ms')<commit_msg>improve test to also include case where there is a low density of include patterns<commit_after>from pysys.constants import *
from xpybuild.xpybuild_basetest import XpybuildBaseTest
import shutil

class PySysTest(XpybuildBaseTest):
	NUMBER_PATTERNS = 50
	NUMBER_TARGETS = 5 # this is just to get a more stable number
	NUMBER_FILES = 2000

	def execute(self):
		self.mkdir('findpathsroot/included')
		self.mkdir('findpathsroot/excluded')
		for i in range(self.NUMBER_FILES):
			open(self.output+'/findpathsroot/included/test%d.txt'%i,'w').close()
			open(self.output+'/findpathsroot/excluded/test%d.txt'%i,'w').close()
		
		self.xpybuild(shouldFail=False, args=['-n', 
			'NUMBER_PATTERNS=%s'%self.NUMBER_PATTERNS, 
			'NUMBER_TARGETS=%s'%self.NUMBER_TARGETS, #'--log-level=debug', #'--profile',
			], stdouterr='xpybuild_many')
		self.xpybuild(shouldFail=False, args=['-n', 
			'NUMBER_PATTERNS=1', 
			'NUMBER_TARGETS=%s'%(self.NUMBER_TARGETS*5), 
			], stdouterr='xpybuild_1')
		try:
			shutil.rmtree(self.output+'/findpathsroot')
		except Exception as e:
			self.log.info('Failed to cleanup findpathsroot: %s', e)

	def validate(self):
		self.assertGrep(file='xpybuild_1.out', expr="ERROR .*", contains=False)
		self.assertGrep(file='xpybuild_many.out', expr="ERROR .*", contains=False)
		
		deps = float(self.getExprFromFile('xpybuild_many.out', 'dependency resolution took ([0-9.]+) s'))
		self.reportPerformanceResult(1000*deps/self.NUMBER_TARGETS/self.NUMBER_FILES, 'PathSet FindPaths resolution time per file with %d include patterns'%self.NUMBER_PATTERNS, 'ms')

		deps = float(self.getExprFromFile('xpybuild_1.out', 'dependency resolution took ([0-9.]+) s'))
		self.reportPerformanceResult(1000*deps/(self.NUMBER_TARGETS*5)/self.NUMBER_FILES, 'PathSet FindPaths resolution time per file with 1 include pattern', 'ms')
{'fraction_non_alphanumeric': 0.14579256360078277, 'fraction_numerical': 0.012720156555772993, 'mean_word_length': 5.755506607929515, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3945679', 'n_tokens_mistral': 1198, 'n_tokens_neox': 1063, 'n_words': 197}