Skip to content

Commit

Permalink
Merge branch 'mr/adjust_tests' into 'master'
Browse files Browse the repository at this point in the history
Adjust basic driver

See merge request eng/toolchain/gnatcoll-core!170
  • Loading branch information
Nikokrock committed Jan 13, 2025
2 parents 34b7cdd + 0b12171 commit 2daf9ef
Show file tree
Hide file tree
Showing 58 changed files with 122 additions and 216 deletions.
20 changes: 11 additions & 9 deletions gprproject/testsuite/drivers/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,16 @@ def run(self):

# Run the test program
test_exe = self.test_env.get("test_exe", "obj/test")
process = run_test_program(
self,
[os.path.join(self.test_env["working_dir"], test_exe)],
slot=self.slot,
copy_files_on_target=copy_files_on_target,
timeout=self.default_process_timeout,
env=self.test_env.get('test_env')
)
self.output += process.out.decode("utf-8")
for run_args in self.test_env.get("run_args", [[]]):
process = run_test_program(
self,
[os.path.join(self.test_env["working_dir"], test_exe)] + run_args,
slot=self.slot,
copy_files_on_target=copy_files_on_target,
timeout=self.default_process_timeout,
env=self.test_env.get('test_env')
)
self.output += process.out.decode("utf-8")

# Store result output, so the python post test can access it if needed.
result_file = open(
Expand All @@ -118,6 +119,7 @@ def run(self):
[interpreter(), post_test_py],
cwd=self.test_env["working_dir"],
timeout=self.default_process_timeout,
input=f"|{self.output}"
)

def compute_failures(self):
Expand Down
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#!/usr/bin/env python3
import sys

EXPECTED_OUTPUT = """
"", ':', IF_EMPTY
=================
Expand Down Expand Up @@ -49,3 +53,11 @@
abs("dir1/foo"): abs("dir1/foo")
Done.
"""

if __name__ == "__main__":
# It would be better to use directly assertions in the test itself
content = sys.stdin.read().replace("\r", "").strip()
assert content == EXPECTED_OUTPUT.strip()
print("<=== TEST PASSED ===>")
sys.exit(0)
12 changes: 12 additions & 0 deletions testsuite/core/tests/file_paths/pre_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from e3.os.fs import touch
from e3.fs import mkdir

if __name__ == "__main__":
mkdir("foo")
mkdir("dir1")
mkdir("dir2")
touch("dir1/foo")
touch("dir2/foo")
touch("dir2/bar")
touch("bar")

3 changes: 2 additions & 1 deletion testsuite/core/tests/file_paths/test.adb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ with GNATCOLL.VFS; use GNATCOLL.VFS;

with GNATCOLL.File_Paths; use GNATCOLL.File_Paths;

procedure Test is
function Test return Integer is

CWD : constant Virtual_File := Get_Current_Dir;

Expand Down Expand Up @@ -101,4 +101,5 @@ begin
Check ("dir2", '|', CWD_Last);

Put_Line ("Done.");
return 0;
end Test;
7 changes: 0 additions & 7 deletions testsuite/core/tests/file_paths/test.gpr

This file was deleted.

3 changes: 0 additions & 3 deletions testsuite/core/tests/file_paths/test.sh

This file was deleted.

1 change: 0 additions & 1 deletion testsuite/core/tests/file_paths/test.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
description: Extensive test for the GNATCOLL.File_Paths API
driver: build_run_diff
control:
- [SKIP, "env.is_cross", "Tests using test.sh currently not supported on cross targets, see T616-039"]
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
with Ada.Containers.Vectors;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;

with GNATCOLL.Opt_Parse; use GNATCOLL.Opt_Parse;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env python3
import sys

if __name__ == "__main__":
content = sys.stdin.read().splitlines()
# Confirm that when permitted, the help text can exceed the previous 80
# character limit without wrapping.
for line in content:
if len(line) > 80:
print("<=== TEST PASSED ===>")
sys.exit(0)
print("there should be at least one line with more than 80 characters")
sys.exit(1)
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
with Mylib;

procedure Test is
function Test return Integer is
begin
Mylib.Run;
return 0;
end Test;

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
driver: build_run_diff
description: Check that a long help message can exceed the default 80 character limit when permitted
run_args:
- ["--help"]
control:
- [SKIP, "env.is_cross", "Tests using test.sh currently not supported on cross targets, see T616-039"]
- [XFAIL, "env.llvm", "partial linking not supported in lld eng/gpr/gpr-issues#428"]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
with Ada.Containers.Vectors;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;

with GNATCOLL.Opt_Parse; use GNATCOLL.Opt_Parse;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env python3
import sys

if __name__ == "__main__":
content = sys.stdin.read().splitlines()
for line in content:
assert len(line) <= 80, f"line too long:{line}"
print("<=== TEST PASSED ===>")
sys.exit(0)
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
with Mylib;

procedure Test is
function Test return Integer is
begin
Mylib.Run;
return 0;
end Test;

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
driver: build_run_diff
description: Check that a long help message wraps at the default 80 character limit
run_args:
- ["--help"]
control:
- [SKIP, "env.is_cross", "Tests using test.sh currently not supported on cross targets, see T616-039"]
- [XFAIL, "env.llvm", "partial linking not supported in lld eng/gpr/gpr-issues#428"]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
with Ada.Containers.Vectors;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;

with GNATCOLL.Opt_Parse; use GNATCOLL.Opt_Parse;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env python3
import sys

if __name__ == "__main__":
content = sys.stdin.read()
# Opposite to help_short_80. There should be more than 20 spaces, which
# was the previous limit after a single character arg like "-c" and a
# fixed 25 character column
assert " " * 20 in content, "at least 20 spaces expected"
print("<=== TEST PASSED ===>")
sys.exit(0)
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
with Mylib;

procedure Test is
function Test return Integer is
begin
Mylib.Run;
return 0;
end Test;

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
driver: build_run_diff
description: Check that long argument name causes the previously default 25 column limit to expand
run_args:
- ["--help"]
control:
- [SKIP, "env.is_cross", "Tests using test.sh currently not supported on cross targets, see T616-039"]
- [XFAIL, "env.llvm", "partial linking not supported in lld eng/gpr/gpr-issues#428"]
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
with Ada.Containers.Vectors;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;

with GNATCOLL.Opt_Parse; use GNATCOLL.Opt_Parse;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
STDOUT=stdout.log
#!/usr/bin/env python3
import sys

./test --help > $STDOUT

# Check that the help message is structured as expected
if ! grep -q -P "( ){4,}" $STDOUT; then
if __name__ == "__main__":
content = sys.stdin.read()
# The biggest whitespace should be the three characters before optional
# arguments as "--help, -h" and "--char, -C" are the same lenght, and
# while they are less than 25 characters, the column number the help
# text starts at should be limited to 2 after the longest arg text.
echo "Help message column reduced as expected"
fi
assert " " not in content, "no more than 3 consecutive whitespaces expected"
print("<=== TEST PASSED ===>")
sys.exit(0)
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
with Mylib;

procedure Test is
function Test return Integer is
begin
Mylib.Run;
return 0;
end Test;

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
driver: build_run_diff
description: Check that long argument name causes the previously default 25 column limit to shrink
run_args:
- ["--help"]
control:
- [SKIP, "env.is_cross", "Tests using test.sh currently not supported on cross targets, see T616-039"]
- [XFAIL, "env.llvm", "partial linking not supported in lld eng/gpr/gpr-issues#428"]
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ package body Mylib is
((1 => GNATCOLL.Strings.To_XString ("--help")));
begin
null;
end;
end Run;

end Mylib;
10 changes: 0 additions & 10 deletions testsuite/core/tests/opt_parse/usage/mylib.gpr

This file was deleted.

5 changes: 0 additions & 5 deletions testsuite/core/tests/opt_parse/usage/parse_output.py

This file was deleted.

Loading

0 comments on commit 2daf9ef

Please sign in to comment.