Skip to content

Commit

Permalink
add file for the test-suite of MG5aMC and a ci related to it
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviermattelaer committed Jun 7, 2024
1 parent a2a77e3 commit ddf5c7b
Show file tree
Hide file tree
Showing 2 changed files with 167 additions and 0 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/madgraph_launch_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# This is a basic workflow to help you get started with Actions

name: running acceptance test
# Controls when the workflow will run
# branches: [ main LTS ]
on:
# Triggers the workflow on push or pull request events but only for the 3.4.0 branch
push:
paths-ignore:
- 'docs/**'
# - '.github/**'

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
message:
description: 'running acceptance test'
required: true

env:
commitmsg: ${{ github.event.head_commit.message }}

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"


SIMD_GG_TT_MIXED:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
with:
submodules: 'true'

# Runs a set of commands using the runners shell
- name: test one of the test testIO_AcceptanceProcOutputIOTests
run: |
cd $GITHUB_WORKSPACE
cd MG5aMC/mg5amcnlo/
cp input/.mg5_configuration_default.txt input/mg5_configuration.txt
cp Template/LO/Source/.make_opts Template/LO/Source/make_opts
./tests/test_manager.py -p./PLUGIN/CUDACPP_OUTPUT/acceptance_tests/ test_ggtt_mixed
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
################################################################################
#
# Copyright (c) 2009 The MadGraph5_aMC@NLO Development team and Contributors
#
# This file is a part of the MadGraph5_aMC@NLO project, an application which
# automatically generates Feynman diagrams and matrix elements for arbitrary
# high-energy processes in the Standard Model and beyond.
#
# It is subject to the MadGraph5_aMC@NLO license which should accompany this
# distribution.
#
# For more information, visit madgraph.phys.ucl.ac.be and amcatnlo.web.cern.ch
#
################################################################################
from __future__ import division
from __future__ import absolute_import
import subprocess
import unittest
import os
import re
import shutil
import sys
import logging
import time
import tempfile
import math
import madgraph


logger = logging.getLogger('test_cmd')

import tests.unit_tests.iolibs.test_file_writers as test_file_writers

import madgraph.interface.master_interface as MGCmd
import madgraph.interface.madevent_interface as MECmd
import madgraph.interface.launch_ext_program as launch_ext
import madgraph.iolibs.files as files

import madgraph.various.misc as misc
import madgraph.various.lhe_parser as lhe_parser
import madgraph.various.banner as banner_mod
import madgraph.various.lhe_parser as lhe_parser
import madgraph.various.banner as banner

_file_path = os.path.split(os.path.dirname(os.path.realpath(__file__)))[0]
_pickle_path =os.path.join(_file_path, 'input_files')

from madgraph import MG4DIR, MG5DIR, MadGraph5Error, InvalidCmd

from tests.acceptance_tests.test_cmd_madevent import *

pjoin = os.path.join


#===============================================================================
# TestCmd
#===============================================================================
class TestCPPfromfile(TestMEfromfile): # inherit from upstream test_cmd_madevent
"""test that we can launch everything from a single file"""



def test_ggtt_mixed(self):
"""checking time of flight is working fine"""

if logging.getLogger('madgraph').level <= 20:
stdout=None
stderr=None
else:
devnull =open(os.devnull,'w')
stdout=devnull
stderr=devnull

try:
shutil.rmtree('/tmp/MGPROCESS/')
except Exception as error:
pass

cmd = """import model sm
set automatic_html_opening False --no_save
set notification_center False --no_save
generate p p > t t~
output madevent_simd %s -f -nojpeg
launch
set nevents 100
""" %self.run_dir

open(pjoin(self.path, 'mg5_cmd'),'w').write(cmd)

subprocess.call([sys.executable, pjoin(MG5DIR, 'bin','mg5_aMC'),
pjoin(self.path, 'mg5_cmd')],
#cwd=self.path,
stdout=stdout, stderr=stderr)

self.check_parton_output(cross=505.5, error=2.749)
event = '%s/Events/run_01/unweighted_events.lhe' % self.run_dir
if not os.path.exists(event):
misc.gunzip(event)

has_zero = False
has_non_zero = False
lhefile = lhe_parser.EventFile(event)
lhefile.apply_fct_on_event(fcts=lhe_parser.Event.check)

nb_event = 0
for event in lhe_parser.EventFile(event):
event.check()
nb_event+=1

self.assertEqual(nb_event, 100)

self.assertFalse(self.debuging)


0 comments on commit ddf5c7b

Please sign in to comment.