def test_delegation_5(self): root = mkdtemp() db, cc = define_jobs(root) job0 = get_job('h', db) self.assertEqual(job0.children, set(['e'])) cc.batch_command('make;ls') job = get_job('h', db) self.assertEqual(job.children, set(['e', 'e-f', 'e-f-g'])) print('parents: %s' % job.parents) print('children: %s' % job.children) cc.batch_command('ls') cc.batch_command('check_consistency raise_if_error=1') # Now just define h again db, cc = define_jobs(root) cc.batch_command('check_consistency raise_if_error=1') job2 = get_job('h', db) self.assertEqual(job2.children, set(['e', 'e-f', 'e-f-g']))
def test_dynamic6(self): # first define with job and run mockup6(self.cc, both=True) db = self.db self.assertRaises(CompmakeBug, jobs_defined, job_id='hd', db=db) self.assert_cmd_success('make recurse=1') check_job_cache_state(job_id='hd', states=[Cache.DONE], db=db) self.assertEqual(jobs_defined(job_id='hd', db=db), set(['hd-id'])) # self.assert_cmd_success('graph compact=0 color=0 ' # 'cluster=1 filter=dot') self.assertJobsEqual('all', ['fd', 'fd-gd', 'fd-gd-g2', 'hd', 'hd-id', 'hd-id-i2', 'summary']) self.assertJobsEqual('done', ['fd', 'fd-gd', 'fd-gd-g2', 'hd', 'hd-id', 'hd-id-i2', 'summary']) # now redo it self.db = StorageFilesystem(self.root, compress=True) self.cc = Context(db=self.db) print('running again with both=False') mockup6(self.cc, both=False) clean_other_jobs(context=self.cc) self.assertJobsEqual('all', ['fd', 'fd-gd', 'fd-gd-g2', 'summary']) job= get_job('summary', self.db) print('job.children: %s' % job.children) print('job.dynamic_children: %s' % job.dynamic_children) self.assertEqual(job.dynamic_children, {'fd': set(['fd-gd'])}) self.assertEqualSet(direct_children('summary', self.db), ['fd', 'fd-gd']) self.assert_cmd_success('ls') self.assert_cmd_success('make recurse=1') self.assertJobsEqual('all', ['fd', 'fd-gd', 'fd-gd-g2', 'summary']) self.assertJobsEqual('done', ['fd', 'fd-gd', 'fd-gd-g2', 'summary'])
def get_job(self, job_id): db = self.cc.get_compmake_db() return get_job(job_id=job_id, db=db)