Skip to content

Commit 9aa4e8b

Browse files
committed
Provide printf function
1 parent 8a397d8 commit 9aa4e8b

File tree

3 files changed

+12
-13
lines changed

3 files changed

+12
-13
lines changed

tests/lit/lit.cfg

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import lit.formats, os, os.path, sys
1+
import lit.formats, os, os.path, sys, subprocess
22
srcDir = os.path.dirname(__file__)
33
config.test_format = lit.formats.ShTest(True)
44
config.pipefail = False
5+
rustyRootDirectory = subprocess.check_output("dirname `cargo locate-project --message-format plain`", shell=True).decode("utf-8").strip()
56

67
# TODO: These need to be adjusted to the action runner / build.sh file
78
# compiler = lit_config.params["COMPILER"]
@@ -13,6 +14,6 @@ config.pipefail = False
1314

1415
# ~/.local/bin/lit -v -DCOMPILER=/home/[email protected]/Development/rusty/target/debug/plc ./tests/lit
1516
compiler = lit_config.params["COMPILER"]
16-
config.substitutions.append(('%COMPILE', f'{compiler} -o /tmp/%basename_t.out --linker=cc'))
17+
config.substitutions.append(('%COMPILE', f'{compiler} -o /tmp/%basename_t.out {rustyRootDirectory}/tests/lit/util/printf.pli --linker=cc'))
1718
config.substitutions.append(('%RUN', f'/tmp/%basename_t.out'))
1819
config.substitutions.append(('%CHECK', f'FileCheck-14 --check-prefixes CHECK --allow-unused-prefixes --match-full-lines'))

tests/lit/single/arithmetic/addition.st

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,3 @@
1-
// TODO: The printf should be a standalone ST file which we link with each other ST file
2-
{external}
3-
FUNCTION printf : DINT
4-
VAR_INPUT {ref}
5-
format : STRING;
6-
END_VAR
7-
VAR_INPUT
8-
args : ...;
9-
END_VAR
10-
END_FUNCTION
11-
121
// RUN: (%COMPILE %s && %RUN) | %CHECK %s
132
FUNCTION main
143
VAR

tests/lit/util/printf.pli

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{external}
2+
FUNCTION printf: DINT
3+
VAR_INPUT {ref}
4+
str : STRING;
5+
END_VAR
6+
VAR_INPUT
7+
args: ...;
8+
END_VAR
9+
END_FUNCTION

0 commit comments

Comments
 (0)