Skip to content

Commit eee1359

Browse files
committed
check: add test which uses color.h
Run the color.h example as a test. Fetch color.h and put it in formlib. Reorganise the "forcer", "checkpoint" and "multithreaded" tests into the "extra" dir, along with the "color" test. Run the extra tests in the valgrind and coverage runs. Some tests are disabled under valgrind and thus also under coverage. Fix the multithreaded test patches settings such that it runs under vorm, tvorm and tvorm -w2 (now that they print warnings if these settings are implicitly adjusted).
1 parent ea8c9cd commit eee1359

File tree

6 files changed

+275
-46
lines changed

6 files changed

+275
-46
lines changed

.github/workflows/test.yml

Lines changed: 99 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,9 @@ jobs:
2323
- {bin: tform, test: default}
2424
- {bin: tform, test: default, nthreads: 2}
2525
- {bin: parform, test: default, timeout: 15}
26-
- {bin: form, test: checkpoint}
27-
- {bin: tform, test: checkpoint}
28-
- {bin: form, test: forcer, timeout: 60}
29-
- {bin: tform, test: forcer, timeout: 60}
30-
- {bin: tform, test: forcer, nthreads: 2, timeout: 60}
31-
- {bin: tform, test: multithreaded}
26+
- {bin: form, test: extra, timeout: 60}
27+
- {bin: tform, test: extra, timeout: 60}
28+
- {bin: tform, test: extra, nthreads: 2, timeout: 60}
3229
steps:
3330
- name: Checkout repository
3431
uses: actions/checkout@v4
@@ -69,7 +66,7 @@ jobs:
6966

7067
- name: Cache library
7168
id: cache-formlib
72-
if: contains(fromJson('["forcer"]'), matrix.test)
69+
if: contains(fromJson('["extra"]'), matrix.test)
7370
uses: actions/cache@v4
7471
with:
7572
path: formlib
@@ -80,11 +77,14 @@ jobs:
8077
run: |
8178
mkdir -p formlib
8279
case ${{ matrix.test }} in
83-
forcer)
80+
extra)
81+
# forcer library for the forcer test in extra
8482
wget https://github.com/benruijl/forcer/archive/v1.0.0.tar.gz -O - | tar -x --gzip
8583
mv forcer-1.0.0/forcer.h formlib
8684
mv forcer-1.0.0/forcer formlib
8785
rm -rf forcer-1.0.0
86+
# color library for the color test in extra
87+
wget https://www.nikhef.nl/~form/maindir/packages/color/color.h -P formlib
8888
;;
8989
esac
9090
@@ -97,37 +97,40 @@ jobs:
9797
# thoroughly by using Valgrind on Linux. To maximize the use of concurrent
9898
# jobs, we divide the tests into smaller parts.
9999
valgrind-check:
100-
name: Valgrind check for ${{ matrix.bin }}${{ matrix.nthreads && format(' -w{0}', matrix.nthreads) || '' }} (${{ matrix.group }})
100+
name: Valgrind check (${{ matrix.test }}) for ${{ matrix.bin }}${{ matrix.nthreads && format(' -w{0}', matrix.nthreads) || '' }} (${{ matrix.group }})
101101
runs-on: ubuntu-24.04
102102
strategy:
103103
fail-fast: false
104104
matrix:
105105
include:
106-
- {bin: vorm, group: 1/5}
107-
- {bin: vorm, group: 2/5}
108-
- {bin: vorm, group: 3/5}
109-
- {bin: vorm, group: 4/5}
110-
- {bin: vorm, group: 5/5}
111-
- {bin: tvorm, group: 1/10}
112-
- {bin: tvorm, group: 2/10}
113-
- {bin: tvorm, group: 3/10}
114-
- {bin: tvorm, group: 4/10}
115-
- {bin: tvorm, group: 5/10}
116-
- {bin: tvorm, group: 6/10}
117-
- {bin: tvorm, group: 7/10}
118-
- {bin: tvorm, group: 8/10}
119-
- {bin: tvorm, group: 9/10}
120-
- {bin: tvorm, group: 10/10}
121-
- {bin: tvorm, nthreads: 2, group: 1/10}
122-
- {bin: tvorm, nthreads: 2, group: 2/10}
123-
- {bin: tvorm, nthreads: 2, group: 3/10}
124-
- {bin: tvorm, nthreads: 2, group: 4/10}
125-
- {bin: tvorm, nthreads: 2, group: 5/10}
126-
- {bin: tvorm, nthreads: 2, group: 6/10}
127-
- {bin: tvorm, nthreads: 2, group: 7/10}
128-
- {bin: tvorm, nthreads: 2, group: 8/10}
129-
- {bin: tvorm, nthreads: 2, group: 9/10}
130-
- {bin: tvorm, nthreads: 2, group: 10/10}
106+
- {bin: vorm, test: default, group: 1/5}
107+
- {bin: vorm, test: default, group: 2/5}
108+
- {bin: vorm, test: default, group: 3/5}
109+
- {bin: vorm, test: default, group: 4/5}
110+
- {bin: vorm, test: default, group: 5/5}
111+
- {bin: tvorm, test: default, group: 1/10}
112+
- {bin: tvorm, test: default, group: 2/10}
113+
- {bin: tvorm, test: default, group: 3/10}
114+
- {bin: tvorm, test: default, group: 4/10}
115+
- {bin: tvorm, test: default, group: 5/10}
116+
- {bin: tvorm, test: default, group: 6/10}
117+
- {bin: tvorm, test: default, group: 7/10}
118+
- {bin: tvorm, test: default, group: 8/10}
119+
- {bin: tvorm, test: default, group: 9/10}
120+
- {bin: tvorm, test: default, group: 10/10}
121+
- {bin: tvorm, test: default, nthreads: 2, group: 1/10}
122+
- {bin: tvorm, test: default, nthreads: 2, group: 2/10}
123+
- {bin: tvorm, test: default, nthreads: 2, group: 3/10}
124+
- {bin: tvorm, test: default, nthreads: 2, group: 4/10}
125+
- {bin: tvorm, test: default, nthreads: 2, group: 5/10}
126+
- {bin: tvorm, test: default, nthreads: 2, group: 6/10}
127+
- {bin: tvorm, test: default, nthreads: 2, group: 7/10}
128+
- {bin: tvorm, test: default, nthreads: 2, group: 8/10}
129+
- {bin: tvorm, test: default, nthreads: 2, group: 9/10}
130+
- {bin: tvorm, test: default, nthreads: 2, group: 10/10}
131+
- {bin: vorm, test: extra, group: 1/1}
132+
- {bin: tvorm, test: extra, group: 1/1}
133+
- {bin: tvorm, test: extra, nthreads: 2, group: 1/1}
131134
steps:
132135
- name: Checkout repository
133136
uses: actions/checkout@v4
@@ -159,21 +162,50 @@ jobs:
159162
- name: Build
160163
run: make -C sources -j 4 ${{ matrix.bin }}
161164

165+
- name: Cache library
166+
id: cache-formlib
167+
if: contains(fromJson('["extra"]'), matrix.test)
168+
uses: actions/cache@v4
169+
with:
170+
path: formlib
171+
key: formlib-${{ matrix.test }}
172+
173+
- name: Install library if necessary
174+
if: steps.cache-formlib.outputs.cache-hit != 'true'
175+
run: |
176+
mkdir -p formlib
177+
case ${{ matrix.test }} in
178+
extra)
179+
# forcer library for the forcer test in extra
180+
wget https://github.com/benruijl/forcer/archive/v1.0.0.tar.gz -O - | tar -x --gzip
181+
mv forcer-1.0.0/forcer.h formlib
182+
mv forcer-1.0.0/forcer formlib
183+
rm -rf forcer-1.0.0
184+
# color library for the color test in extra
185+
wget https://www.nikhef.nl/~form/maindir/packages/color/color.h -P formlib
186+
;;
187+
esac
188+
162189
- name: Test
163-
run: ./check/check.rb valgrind ./sources/${{ matrix.bin }} --stat -g ${{ matrix.group }} --retries 5 ${{ matrix.nthreads && format('-w{0}', matrix.nthreads) || '' }}
190+
run: ./check/check.rb valgrind ./sources/${{ matrix.bin }} --stat -g ${{ matrix.group }} --retries 5 ${{ matrix.nthreads && format('-w{0}', matrix.nthreads) || '' }} ${{ matrix.test != 'default' && format('-C {0}', matrix.test) || '' }}
191+
env:
192+
FORMPATH: ${{ github.workspace }}/formlib
164193

165194
# Generate LCOV coverage data to be posted to coveralls.io. Note that
166195
# we measure code coverage only for tests checked with Valgrind.
167196
coverage:
168-
name: Code coverage for ${{ matrix.bin }}${{ matrix.nthreads && format(' -w{0}', matrix.nthreads) || '' }}
197+
name: Code coverage (${{ matrix.test }}) for ${{ matrix.bin }}${{ matrix.nthreads && format(' -w{0}', matrix.nthreads) || '' }}
169198
runs-on: ubuntu-24.04
170199
strategy:
171200
fail-fast: false
172201
matrix:
173202
include:
174-
- {bin: vorm}
175-
- {bin: tvorm}
176-
- {bin: tvorm, nthreads: 2}
203+
- {bin: vorm, test: default}
204+
- {bin: tvorm, test: default}
205+
- {bin: tvorm, test: default, nthreads: 2}
206+
- {bin: vorm, test: extra, timeout: 60}
207+
- {bin: tvorm, test: extra, timeout: 60}
208+
- {bin: tvorm, test: extra, nthreads: 2, timeout: 60}
177209
steps:
178210
- name: Checkout repository
179211
uses: actions/checkout@v4
@@ -202,8 +234,34 @@ jobs:
202234
- name: Build
203235
run: make -C sources -j 4 ${{ matrix.bin }}
204236

237+
- name: Cache library
238+
id: cache-formlib
239+
if: contains(fromJson('["extra"]'), matrix.test)
240+
uses: actions/cache@v4
241+
with:
242+
path: formlib
243+
key: formlib-${{ matrix.test }}
244+
245+
- name: Install library if necessary
246+
if: steps.cache-formlib.outputs.cache-hit != 'true'
247+
run: |
248+
mkdir -p formlib
249+
case ${{ matrix.test }} in
250+
extra)
251+
# forcer library for the forcer test in extra
252+
wget https://github.com/benruijl/forcer/archive/v1.0.0.tar.gz -O - | tar -x --gzip
253+
mv forcer-1.0.0/forcer.h formlib
254+
mv forcer-1.0.0/forcer formlib
255+
rm -rf forcer-1.0.0
256+
# color library for the color test in extra
257+
wget https://www.nikhef.nl/~form/maindir/packages/color/color.h -P formlib
258+
;;
259+
esac
260+
205261
- name: Test
206-
run: ./check/check.rb ./sources/${{ matrix.bin }} --stat --timeout 30 ${{ matrix.nthreads && format('-w{0}', matrix.nthreads) || '' }} --fake-valgrind
262+
run: ./check/check.rb ./sources/${{ matrix.bin }} --stat --timeout ${{ matrix.timeout && format('--timeout {0}', matrix.timeout) || '30' }} ${{ matrix.nthreads && format('-w{0}', matrix.nthreads) || '' }} ${{ matrix.test != 'default' && format('-C {0}', matrix.test) || '' }} --fake-valgrind
263+
env:
264+
FORMPATH: ${{ github.workspace }}/formlib
207265

208266
- name: Generate LCOV coverage data
209267
run: |
@@ -213,7 +271,7 @@ jobs:
213271
- name: Coveralls Parallel
214272
uses: coverallsapp/github-action@v2
215273
with:
216-
flag-name: ${{ matrix.bin }}${{ matrix.nthreads && format(' -w{0}', matrix.nthreads) || '' }}
274+
flag-name: ${{ matrix.bin }}${{ matrix.nthreads && format(' -w{0}', matrix.nthreads) || '' }} (${{ matrix.test }})
217275
parallel: true
218276

219277
# Post LCOV coverage data to coveralls.io.

check/Makefile.am

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,12 @@ EXTRA_DIST = \
3030
benchmark-fu.sh \
3131
check-help.sh \
3232
check.rb \
33-
checkpoint/checkpoint.frm \
3433
examples.frm \
34+
extra/checkpoint.frm \
35+
extra/color.frm \
36+
extra/forcer.frm \
37+
extra/multithreaded.frm \
3538
features.frm \
3639
fixes.frm \
37-
forcer/forcer.frm \
38-
formunit/fu.frm
40+
formunit/fu.frm \
41+
user.frm
File renamed without changes.

check/extra/color.frm

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
#ifndef `TEST'
2+
#message Use -D TEST=XXX
3+
#terminate
4+
#else
5+
#include `NAME_' # `TEST'
6+
#endif
7+
.end
8+
9+
*--#[ color_tloop :
10+
#-
11+
12+
* This is a modified version of tloop.frm from the color.h example files.
13+
14+
Off Statistics;
15+
16+
* Larger than 5 becomes extremely slow under valgrind.
17+
#define SIZE "5"
18+
*#define ALTERNATEMETHOD "1"
19+
*
20+
* Test program for the color traces in the paper and a few more.
21+
* The paper: "Color traces for arbitrary groups"
22+
* by T. van Ritbergen, A.N. Schellekens and J.A.M. Vermaseren.
23+
*
24+
* The object is to express color traces in terms of group invariants
25+
* in such a way that the group has not been specified yet. The few
26+
* remaining invariants can be substituted afterwards. The expressions
27+
* in terms of invariants are better for publications. One sees more
28+
* about the structure of the problem this way.
29+
*
30+
* All declarations are made in the file cfactors.h
31+
* One needs version 3 or later of FORM to run these programs.
32+
* The programs will handle all color structures with up to 14 vertices.
33+
* One vertex is one generator in any representation.
34+
* Currently the program handles only one type of non-adjoint representaion.
35+
* If there are two different representations of such type one has to
36+
* try to run the problem in stages.
37+
*
38+
* Examples are:
39+
* One quark-loop with SIZE gluons in a maximally non-planar configuration
40+
* (TYPE = qloop)
41+
* Same but qluon loop (everything in the adjoint representation)
42+
* (TYPE = gloop)
43+
* Two quark loops with SIZE connecting gluons like a circular ladder.
44+
* (TYPE = qqloop)
45+
* Same with one quark loop and one gluon loop.
46+
* (TYPE = qgloop)
47+
* Same with two gluon loops.
48+
* (TYPE = ggloop)
49+
* The Coxeter graph (diagram with 14 vertices in the adjoint representation
50+
* in which there are no loops with fewer than 6 lines) (TYPE = g14)
51+
*
52+
* One should not choose SIZE larger than 7 or most likely the simplification
53+
* routine cannot simplify the final result completely (in some rare cases
54+
* it can though for SIZE = 8).
55+
* For execution times, see the paper.
56+
* It does get very slow for quarks and SIZE > 7.
57+
*
58+
* Program by J.Vermaseren, 24-may-1997
59+
*
60+
#include color.h
61+
AutoDeclare Index i,j,k;
62+
CFunction acc;
63+
Symbol x;
64+
.global
65+
G Q{2*`SIZE'} = <T(i1,i2,j1)>*...*<T(i`SIZE',i{`SIZE'+1},j`SIZE')>
66+
*<T(i{`SIZE'+1},i{`SIZE'+2},j1)>*...*<T(i{`SIZE'*2},i{2*`SIZE'+1},j`SIZE')>
67+
*replace_(i{`SIZE'*2+1},i1);
68+
69+
G G{2*`SIZE'} = <f(i1,i2,j1)>*...*<f(i`SIZE',i{`SIZE'+1},j`SIZE')>
70+
*<f(i{`SIZE'+1},i{`SIZE'+2},j1)>*...*<f(i{`SIZE'*2},i{2*`SIZE'+1},j`SIZE')>
71+
*replace_(i{`SIZE'*2+1},i1);
72+
73+
G QQ`SIZE' = <T(i1,i2,j1)>*...*<T(i`SIZE',i{`SIZE'+1},j`SIZE')>
74+
*<T(k1,k2,j1)>*...*<T(k`SIZE',k{`SIZE'+1},j`SIZE')>
75+
*replace_(i{`SIZE'+1},i1,k{`SIZE'+1},k1);
76+
77+
G QG`SIZE' = <T(i1,i2,j1)>*...*<T(i`SIZE',i{`SIZE'+1},j`SIZE')>
78+
*<f(k1,k2,j1)>*...*<f(k`SIZE',k{`SIZE'+1},j`SIZE')>
79+
*replace_(i{`SIZE'+1},i1,k{`SIZE'+1},k1);
80+
81+
G GG`SIZE' = <f(i1,i2,j1)>*...*<f(i`SIZE',i{`SIZE'+1},j`SIZE')>
82+
*<f(k1,k2,j1)>*...*<f(k`SIZE',k{`SIZE'+1},j`SIZE')>
83+
*replace_(i{`SIZE'+1},i1,k{`SIZE'+1},k1);
84+
85+
* These take too long under valgrind.
86+
*G girth14 =
87+
* f(i1,i2,i3)*f(i1,i4,i5)*f(i2,i6,i7)*f(i3,i8,i9)
88+
* *f(i4,i10,i11)*f(i5,i12,i13)*f(i6,i14,i15)*f(i7,i16,i17)
89+
* *f(i8,i18,i19)*f(i9,i20,i21)
90+
* *f(i10,i21,i15)*f(i13,i19,i14)*f(i17,i11,i18)*f(i12,i16,i20);
91+
*
92+
*G girth24 =
93+
* f(i36,i1,i2)*f(i36,i3,i4)*f(i1,i5,i6)*f(i2,i7,i8)
94+
* *f(i3,i9,i10)*f(i4,i11,i12)*f(i5,i13,i14)*f(i6,i15,i16)
95+
* *f(i7,i17,i18)*f(i8,i19,i20)*f(i9,i21,i22)*f(i10,i23,i24)
96+
* *f(i11,i25,i26)*f(i12,i27,i28)*f(i13,i23,i29)*f(i14,i27,i30)
97+
* *f(i15,i25,i31)*f(i16,i21,i32)*f(i17,i26,i29)*f(i18,i32,i33)
98+
* *f(i19,i31,i34)*f(i20,i22,i30)*f(i24,i34,i35)*f(i28,i33,i35);
99+
*
100+
*G fiveq = T(i1,i2,j1)*T(i2,i3,j2)*T(i3,i1,j3)*
101+
* T(i4,i5,j2)*T(i5,i6,j4)*T(i6,i4,j5)*
102+
* T(i7,i8,j4)*T(i8,i9,j6)*T(i9,i7,j7)*
103+
* T(i10,i11,j6)*T(i11,i12,j1)*T(i12,i10,j8)*
104+
* T(i13,i14,j3)*T(i14,i15,j5)*T(i15,i16,j7)*T(i16,i13,j8);
105+
106+
Sum i1,...,i{`SIZE'*2},j1,...,j`SIZE',k1,...,k`SIZE';
107+
.sort
108+
109+
#call color
110+
#call SORT(tloop-1)
111+
#call adjoint
112+
#call SORT(tloop-2)
113+
.sort
114+
#call simpli
115+
id acc(x?) = x;
116+
*Print +s;
117+
.sort
118+
119+
* Check results
120+
Local Q10 = - Q10
121+
+ NA*I2R*cR^4
122+
- 5*NA*I2R*cA*cR^3
123+
+ 35/4*NA*I2R*cA^2*cR^2
124+
- 155/24*NA*I2R*cA^3*cR
125+
+ 125/72*NA*I2R*cA^4
126+
+ 5*d44(cOlpR1,cOlpA1)*cR
127+
- 6*d44(cOlpR1,cOlpA1)*cA
128+
+ 1/3*d44(cOlpA1,cOlpA2)*I2R
129+
;
130+
131+
Local G10 = - G10
132+
- 1/36*NA*cA^5
133+
+ 2/3*d44(cOlpA1,cOlpA2)*cA
134+
;
135+
136+
Local QQ5 = - QQ5
137+
- 5/144*NA*I2R^2*cA^3
138+
+ 11/48*d33(cOlpR1,cOlpR2)*cA^2
139+
- 5/6*d44(cOlpR1,cOlpR2)*cA
140+
+ 1/6*d44(cOlpR1,cOlpA1)*I2R
141+
+ d55(cOlpR1,cOlpR2)
142+
;
143+
144+
Local QG5 = - QG5
145+
- 5/144*i_*NA*I2R*cA^4
146+
- 3/4*d44(cOlpR1,cOlpA1)*i_*cA
147+
+ 1/12*d44(cOlpA1,cOlpA2)*i_*I2R
148+
;
149+
150+
Local GG5 = - GG5
151+
+ 5/144*NA*cA^5
152+
+ 2/3*d44(cOlpA1,cOlpA2)*cA
153+
;
154+
.sort
155+
156+
#do ex = {`activeexprnames_'}
157+
#if `ZERO_`ex'' == 0
158+
#message Error in `ex'
159+
#terminate
160+
#endif
161+
#enddo
162+
163+
.end
164+
assert succeeded?
165+
*--#] color_tloop :

0 commit comments

Comments
 (0)