diff --git a/lib/galaxy/web/controllers/dataset.py b/lib/galaxy/web/controllers/dataset.py index 449bf06dd00..c7e86d166ff 100644 --- a/lib/galaxy/web/controllers/dataset.py +++ b/lib/galaxy/web/controllers/dataset.py @@ -154,10 +154,24 @@ class DatasetInterface( BaseUIController, UsesAnnotations, UsesHistory, UsesHist hda = trans.sa_session.query( model.HistoryDatasetAssociation ).get( id ) return trans.fill_template( "dataset/errors.mako", hda=hda ) @web.expose - def stderr( self, trans, id ): - dataset = trans.sa_session.query( model.HistoryDatasetAssociation ).get( id ) - job = dataset.creating_job_associations[0].job + def stdout( self, trans, dataset_id=None, **kwargs ): trans.response.set_content_type( 'text/plain' ) + try: + hda = trans.sa_session.query( trans.app.model.HistoryDatasetAssociation ).get( trans.security.decode_id( dataset_id ) ) + assert hda and trans.app.security_agent.can_access_dataset( trans.get_current_user_roles(), hda.dataset ) + job = hda.creating_job_associations[0].job + except: + return "Invalid dataset ID or you are not allowed to access this dataset" + return job.stdout + @web.expose + def stderr( self, trans, dataset_id=None, **kwargs ): + trans.response.set_content_type( 'text/plain' ) + try: + hda = trans.sa_session.query( trans.app.model.HistoryDatasetAssociation ).get( trans.security.decode_id( dataset_id ) ) + assert hda and trans.app.security_agent.can_access_dataset( trans.get_current_user_roles(), hda.dataset ) + job = hda.creating_job_associations[0].job + except: + return "Invalid dataset ID or you are not allowed to access this dataset" return job.stderr @web.expose def report_error( self, trans, id, email='', message="" ): diff --git a/scripts/functional_tests.py b/scripts/functional_tests.py index dc8fa1a754d..66f2ad682f6 100644 --- a/scripts/functional_tests.py +++ b/scripts/functional_tests.py @@ -58,6 +58,7 @@ def main(): tool_path = os.environ.get( 'GALAXY_TEST_TOOL_PATH', 'tools' ) tool_config_file = os.environ.get( 'GALAXY_TEST_TOOL_CONF', 'tool_conf.xml.sample' ) tool_data_table_config_path = 'tool_data_table_conf.xml' + tool_dependency_dir = os.environ.get( 'GALAXY_TOOL_DEPENDENCY_DIR', None ) if os.path.exists( 'tool_data_table_conf.test.xml' ): tool_data_table_config_path = 'tool_data_table_conf.test.xml' if start_server: @@ -149,6 +150,9 @@ def main(): if not database_connection.startswith( 'sqlite://' ): kwargs['database_engine_option_max_overflow'] = '20' + if tool_dependency_dir is not None: + kwargs['tool_dependency_dir'] = tool_dependency_dir + # Build the Universe Application app = UniverseApplication( job_queue_workers = 5, id_secret = 'changethisinproductiontoo', diff --git a/test/base/twilltestcase.py b/test/base/twilltestcase.py index fff6c754f7e..c12654c5eb8 100644 --- a/test/base/twilltestcase.py +++ b/test/base/twilltestcase.py @@ -624,6 +624,14 @@ class TwillTestCase( unittest.TestCase ): fd,temp_prefix = tempfile.mkstemp(prefix='tmp',suffix=suffix) return temp_prefix + def get_history_dataset_stdout( self, hda_id ): + self.visit_page( "/datasets/%s/stdout" % hda_id ) + return self.last_page() + + def get_history_dataset_stderr( self, hda_id ): + self.visit_page( "/datasets/%s/stderr" % hda_id ) + return self.last_page() + def verify_dataset_correctness( self, filename, hid=None, wait=True, maxseconds=120, attributes=None ): """Verifies that the attributes and contents of a history item meet expectations""" if wait: diff --git a/test/functional/test_toolbox.py b/test/functional/test_toolbox.py index 1843ada7ede..4a2b53eae07 100644 --- a/test/functional/test_toolbox.py +++ b/test/functional/test_toolbox.py @@ -93,7 +93,19 @@ class ToolTestCase( TwillTestCase ): self.assertTrue( elem is not None ) elem_hid = elem.get( 'hid' ) elem_index += 1 - self.verify_dataset_correctness( outfile, hid=elem_hid, maxseconds=testdef.maxseconds, attributes=attributes ) + try: + self.verify_dataset_correctness( outfile, hid=elem_hid, maxseconds=testdef.maxseconds, attributes=attributes ) + except Exception, e: + print '-----------' + print 'Job STDOUT:' + print '-----------' + print self.get_history_dataset_stdout( elem.get( 'id' ) ) + print '-----------' + print 'Job STDERR:' + print '-----------' + print self.get_history_dataset_stderr( elem.get( 'id' ) ) + print '-----------' + raise self.delete_history( id=self.security.encode_id( latest_history.id ) ) def __expand_grouping( self, tool_inputs, declared_inputs, prefix='' ):