Skip to content

Commit bbc93f6

Browse files
authored
Merge pull request #711 from KxSystems/qcumber-ci
Run qcumber on CI
2 parents 6e1cd55 + 1ed659f commit bbc93f6

File tree

10 files changed

+275
-485
lines changed

10 files changed

+275
-485
lines changed

.github/workflows/dev.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,25 @@ jobs:
5151
name: lcov
5252
path: coverage-reports/lcov.info
5353
retention-days: 1
54+
test-q:
55+
runs-on: ubuntu-latest
56+
steps:
57+
- name: Checkout
58+
uses: actions/checkout@v4
59+
- name: Login to GitLab
60+
uses: docker/login-action@v3
61+
with:
62+
registry: registry.gitlab.com
63+
username: ${{ secrets.GL_REG_USERNAME }}
64+
password: ${{ secrets.GL_REG_TOKEN }}
65+
- name: Run qCumber
66+
run: ./qcumber.sh -src test/q/main.q -test test/q/tests
67+
env:
68+
KDB_K4LICENSE_B64: ${{ secrets.KDB_K4LICENSE_B64 }}
69+
5470

5571
app-sec:
56-
needs: test
72+
needs: [test, test-q]
5773
if: "! github.event.pull_request.head.repo.fork "
5874
uses: ./.github/workflows/app-sec-template.yml
5975
with:

.github/workflows/main.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,24 @@ jobs:
5151
name: lcov
5252
path: coverage-reports/lcov.info
5353
retention-days: 1
54+
test-q:
55+
runs-on: ubuntu-latest
56+
steps:
57+
- name: Checkout
58+
uses: actions/checkout@v4
59+
- name: Login to GitLab
60+
uses: docker/login-action@v3
61+
with:
62+
registry: registry.gitlab.com
63+
username: ${{ secrets.GL_REG_USERNAME }}
64+
password: ${{ secrets.GL_REG_TOKEN }}
65+
- name: Run qCumber
66+
run: ./qcumber.sh -src test/q/main.q -test test/q/tests
67+
env:
68+
KDB_K4LICENSE_B64: ${{ secrets.KDB_K4LICENSE_B64 }}
5469

5570
app-sec:
56-
needs: test
71+
needs: [test, test-q]
5772
if: "! github.event.pull_request.head.repo.fork "
5873
uses: ./.github/workflows/app-sec-template.yml
5974
with:

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1217,7 +1217,8 @@
12171217
"preui-test-cmd": "tsc --outdir out-test --strict false",
12181218
"ui-test-cmd": "extest setup-and-run --code_version 1.101.0 --code_settings ./test/ui/fixtures/settings.json --extensions_dir ./.test-extensions --storage ./.test-folder -m ./test/ui/fixtures/mocha.json",
12191219
"preui-test": "rimraf out-test .test-extensions",
1220-
"ui-test": "npm run ui-test-cmd -- ./out-test/test/ui/**/*.test.js"
1220+
"ui-test": "npm run ui-test-cmd -- ./out-test/test/ui/**/*.test.js",
1221+
"q-test": "arch -x86_64 q $AXLIBRARIES_HOME/ws/qcumber.q_ -color -src ./test/q/main.q -test ./test/q/tests"
12211222
},
12221223
"devDependencies": {
12231224
"@eslint/js": "9.39.2",

qcumber.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
3+
# Runs qcumber in a docker image
4+
# usage:
5+
# qcumber.sh -src test/main.q -test test
6+
7+
QBUILD_IMAGE="registry.gitlab.com/kxdev/cloud/packaging/qpacker/qpbuild:2.1.41"
8+
CMD="/app/qbuild/scripts/qcumber -color -q $*"
9+
SETUP="if [ -f /app/project/test/q/preTest.sh ]; then source /app/project/test/q/preTest.sh; fi"
10+
11+
docker run --rm \
12+
-e KDB_K4LICENSE_B64 \
13+
-v $(pwd):/app/project \
14+
-w /app/project \
15+
"$QBUILD_IMAGE" \
16+
bash -c "$SETUP; $CMD"

test/q/main.q

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@[system"l ",;"pykx.q";{::}]
2+
if[getenv[`CI]~"true";system "cd /app/project"];

test/q/preTest.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
3+
pip install "pykx~=2.5"
4+
python -c "import pykx;pykx.install_into_QHOME()"

test/q/tests/evaluate.quke

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
feature EDI
2+
before
3+
.test.src: "\n" sv read0 `:resources/evaluate.q;
4+
.test.evaluate: {[ctx; code; returnFormat]
5+
0i (.test.src; ctx; code; returnFormat)
6+
};
7+
.test.dims : system "c";
8+
.test.precision: system "P";
9+
.test.attrLines: ("dict: `s#`a`b`c`d`e`f`g!enlist each 7?0";
10+
"dict[`e] : dict[`e] , 1";
11+
"attr dict");
12+
after
13+
delete dict from `.;
14+
15+
after each
16+
system "c ", " " sv string .test.dims;
17+
system "P ", string .test.precision;
18+
19+
// @TICKET KXI-9607
20+
should ensure EDI performs display correctly for standard expressions
21+
// @TICKET KXI-12260
22+
expect simple expression of 3+3 to return 6:
23+
.qu.compare[.test.evaluate["."; "3+3"; "serialized"]`result; 6]
24+
25+
// This test is skipped because coverage is not handling generic null correctly in QBUILD 1.0.17 and greater
26+
// @TICKET KXI-12260
27+
xexpect projection null to return as generic null
28+
.qu.compare[.test.evaluate["."; "last value (;;)"; "serialized"]`result; (::)]
29+
30+
expect function definition to work:
31+
.qu.compare[.test.evaluate["."; ".test.fn333: {: 333}"; "serialized"]`result; {: 333}]
32+
33+
expect function call to work and return 333:
34+
.qu.compare[.test.evaluate["."; ".test.fn333 []"; "serialized"]`result; 333]
35+
36+
xexpect each right and each left of similar expressions to be equal:
37+
.com_kx_edi.dropIrrelevantRecords[.com_kx_ediNoCoverage.evaluate["1 2 3 +\\: 10"; "."]] ~ .com_kx_edi.dropIrrelevantRecords .com_kx_ediNoCoverage.evaluate["10 +/: 1 2 3"; "."]
38+
39+
expect scan to work and return 11 13 16:
40+
.qu.compare[.test.evaluate["."; "10 +\\ 1 2 3"; "serialized"]`result; 11 13 16]
41+
42+
expect over to work and return 16:
43+
.qu.compare[.test.evaluate["."; "10 +/ 1 2 3"; "serialized"]`result; 16]
44+
45+
expect a list created by EDI to be equal to the list:
46+
.qu.compare[.test.evaluate["."; "1 2 3 4 5 6 7 8"; "serialized"]`result; 1 2 3 4 5 6 7 8]
47+
48+
expect an expression that creates a list to return the correct list:
49+
.qu.compare[.test.evaluate["."; "`char$97+til 26"; "serialized"]`result; "abcdefghijklmnopqrstuvwxyz"]
50+
51+
expect the concat of two lists to be the same:
52+
.qu.compare[.test.evaluate["."; "(til 100),(til 100)"; "serialized"]`result; (til[100], til 100)]
53+
54+
// @TICKET KXI-9607
55+
should ensure EDI performs display correctly for k expressions
56+
expect simple k expressions to work, 3+3=6:
57+
.qu.compare[.test.evaluate["."; "k) 3 + 3"; "serialized"]`result; 6]
58+
59+
expect more complicated k expressions to work such as over:
60+
.qu.compare[.test.evaluate["."; "k) +/1 2 3 4"; "serialized"]`result; 10]
61+
62+
expect more complicated k expressions to work such as dyadic function over:
63+
.qu.compare[.test.evaluate["."; "k) {x+2*y}/1 2 3 4"; "serialized"]`result; 19]
64+
65+
expect more complicated k expressions to work such as monadic each both:
66+
.qu.compare[.test.evaluate["."; "k) (-':)1 2 3 4"; "serialized"]`result; 1 1 1 1]
67+
68+
expect more complicated k expressions to work such as monadic each both:
69+
.qu.compare[.test.evaluate["."; "k) +\\1 2 3 4"; "serialized"]`result; 1 3 6 10]
70+
71+
expect a string to be a string in k:
72+
.qu.compare[.test.evaluate["."; "k) \"hello\\\\there\""; "serialized"]`result; "hello\\there"]
73+
74+
// @TICKET KXI-9607
75+
should ensure EDI performs display correctly for system expressions
76+
expect it to return timing information:
77+
// this fails intermittently on windows for some reason ...
78+
10 > .test.evaluate["."; "\\t count \"doug\""; "serialized"]`result
79+
80+
expect expression in t to set zz correctly:
81+
(.test.zz ~ 4) and (10 > .test.evaluate["."; "\\t .test.zz: count \"doug\""; "serialized"]`result)
82+
83+
expect simple expression in t to work correctly:
84+
(.test.zz ~ 4) and (10 > .test.evaluate["."; "\\t .test.zz: 1 + 1 + 1 + 1"; "serialized"]`result)
85+
86+
expect ts to return time and space:
87+
.qu.compare[count .test.evaluate["."; "\\ts til 10000"; "serialized"]`result; 2]
88+
89+
expect workspace information to return correctly (should usually work but may fail):
90+
(last system "w") ~ last .test.evaluate["."; "\\w"; "serialized"]`result
91+
92+
expect ls os command to return data back as a general list equivalent to system call:
93+
$["w" ~ first string .z.o;
94+
// The /b is needed to show the simple results,
95+
// as if just "dir" is used, the results can change between the two calls
96+
(system "dir /b") ~ .test.evaluate["."; "\\dir /b"; "serialized"]`result;
97+
(system "ls") ~ .test.evaluate["."; "\\ls"; "serialized"]`result];
98+
99+
expect pwd os command to return the current directory equivalent to system call:
100+
(system "cd") ~ .test.evaluate["."; "\\cd"; "serialized"]`result
101+
102+
expect a to return a list of tables:
103+
11h ~ type .test.evaluate["."; "\\a"; "serialized"]`result
104+
105+
expect c to return the console size:
106+
6h ~ type .test.evaluate["."; "\\c"; "serialized"]`result
107+
108+
expect c 100 100 to set the console to 100 100:
109+
.test.evaluate["."; "\\c 100 100"; "serialized"]`result;
110+
100 100i ~ system "c"
111+
112+
expect p to provide the port:
113+
system["p"] ~ .test.evaluate["."; "\\p"; "serialized"]`result
114+
115+
expect P to provide the precision:
116+
system["P"] ~ .test.evaluate["."; "\\P"; "serialized"]`result
117+
118+
expect setting precision to 4 for it to be set to 4:
119+
(system ["P"] ~ 4i) and (::) ~ .test.evaluate["."; "\\P 4"; "serialized"]`result
120+
121+
expect setting the precision to 0 sets it to max (same as 16):
122+
(system ["P"] ~ 0i) and (::) ~ .test.evaluate["."; "\\P 0"; "serialized"]`result
123+
124+
// @TICKET KXI-9607
125+
should work for non-default contexts
126+
expect correct expression result
127+
6 ~ .test.evaluate[".test"; "3+3"; "serialized"]`result
128+
129+
expect function to be compiled in the correct context
130+
`foo ~ first @[;3] value .test.evaluate[".foo"; "fn:{3+3}"; "serialized"]`result
131+
132+
// @TICKET KXI-9607
133+
should accept alternate values to indicate "."
134+
expect correct expression result
135+
.test.ctx: system "d";
136+
system "d .ignore";
137+
.test.evaluate["."; "myVal1: `first"; "serialized"]`result;
138+
.test.evaluate["."; "myVal2: `second"; "serialized"]`result;
139+
system "d " , string .test.ctx;
140+
`first`second ~ get each `..myVal1`..myVal2;
141+
after
142+
delete myVal1 from `.;
143+
delete myVal2 from `.;
144+
145+
// @TICKET KXI-9607
146+
// @TICKET KXI-16397
147+
should not remove things that look like comments
148+
expect the /test to not be removed
149+
// This needs the trim, because it returns "/test " on windows
150+
trim[.test.evaluate["."; "\\echo /test"; "serialized"]`result] ~ enlist "/test"
151+
152+
// @TICKET KXI-9607
153+
// @TICKET KXI-16397
154+
should handle windows line endings
155+
expect this to be treated as a single expression
156+
.qu.compare[.test.evaluate["."; "(1\r\n\r\n 2 3)"; "serialized"]`result; 1 2 3]
157+
158+
// @TICKET KXI-9607
159+
should maintain attributes regardless of semi-colon (KXAX-16342)
160+
expect an attribute with no semi colons
161+
`s ~ .test.evaluate["."; "\n" sv .test.attrLines; "serialized"]`result
162+
expect an attribute with semi colons
163+
`s ~ .test.evaluate["."; "\n" sv .test.attrLines ,\: ";"; "serialized"]`result
164+
expect an attribute with no semi colons with two newlines
165+
`s ~ .test.evaluate["."; "\n\n" sv .test.attrLines; "serialized"]`result
166+
expect an attribute with semi colons with two newlines
167+
`s ~ .test.evaluate["."; "\n\n" sv .test.attrLines ,\: ";"; "serialized"]`result

0 commit comments

Comments
 (0)