Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion changelog-entries/811.md

This file was deleted.

1 change: 1 addition & 0 deletions changelog-entries/882.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Store each `reference-results-metadata.md` inside the case directory of its reference results archive instead of sharing one metadata file between all archives of a tutorial. The SHA256 checksum of the outer archive is no longer included, because the metadata now lives inside that archive [#882](https://github.com/precice/tutorials/pull/882), [#894](https://github.com/precice/tutorials/pull/894).
6 changes: 3 additions & 3 deletions tools/tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ To reproduce the comparison locally, use the [same fieldcompare command](https:/
```bash
fieldcompare dir precice-exports/ reference-results-unpacked/<case>/ \
--ignore-missing-reference-files \
--exclude-files reference-results-metadata.txt \
--exclude-files reference-results-metadata.md \
--ignore-unsupported-file-formats \
-rtol 3e-7
```
Expand Down Expand Up @@ -177,7 +177,7 @@ The two options cannot be combined: defining any overrides to `reference_version

The results will be added to a Git LFS, but you will need special push access: just use the aforementioned GitHub Actions workflow, instead.

Each generated reference archive contains a `reference-results-metadata.txt` file
Each generated reference archive contains a `reference-results-metadata.md` file
inside its case directory. This file records the component versions and machine
information used to generate that archive.

Expand Down Expand Up @@ -289,7 +289,7 @@ Metadata and workflow/script files:
- `docker-compose.template.yaml`: Describes how to prepare each test (Docker Compose service template)
- `docker-compose.field_compare.template.yaml`: Describes how to compare results with fieldcompare (Docker Compose service template)
- `components.yaml`: Declares the available components and their parameters/options
- `reference-results-metadata.txt.template`: Template for reporting the versions and machine used to generate each reference results archive
- `reference-results-metadata.md.template`: Template for reporting the versions and machine used to generate each reference results archive
- `reference_versions.yaml`: List of arguments to use for generating the reference results
- `tests.yaml`: Declares the available tests, grouped in test suites

Expand Down
2 changes: 1 addition & 1 deletion tools/tests/docker-compose.field_compare.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ services:
command:
- /runs/{{ tutorial_folder }}/{{ precice_output_folder }}
- /runs/{{ tutorial_folder }}/{{ reference_output_folder }}
- "-rtol {{ tolerance }} --ignore-missing-reference-files --exclude-files reference-results-metadata.txt --ignore-unsupported-file-formats --diff"
- "-rtol {{ tolerance }} --ignore-missing-reference-files --exclude-files reference-results-metadata.md --ignore-unsupported-file-formats --diff"
19 changes: 5 additions & 14 deletions tools/tests/generate_reference_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def create_reference_tar_gz(
shutil.rmtree(staging)
shutil.copytree(exports_dir, exports_staging)
try:
(exports_staging / "reference-results-metadata.txt").write_text(metadata)
(exports_staging / "reference-results-metadata.md").write_text(metadata)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, naming that .reference-results-metadata.md would place it at the top of the file list, at least for my archive manager. I can rename it tomorrow.

with tarfile.open(output_filename, "w:gz") as tar:
tar.add(exports_staging, arcname=stem)
if iterations_logs:
Expand All @@ -50,7 +50,7 @@ def create_reference_tar_gz(
shutil.rmtree(logs_staging, ignore_errors=True)


def get_machine_informations():
def get_machine_information():
def command_is_avail(command: str):
try:
rc = subprocess.call(['which', command], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
Expand All @@ -59,37 +59,28 @@ def command_is_avail(command: str):

return rc == 0
uname_info = "uname not available on the machine the systemtests were executed."
lscpu_info = "lscpu not available on the machine the systemtests were executed."
if (command_is_avail("uname")):
result = subprocess.run(["uname", "-a"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
if result.returncode == 0:
uname_info = result.stdout

if (command_is_avail("lscpu") and command_is_avail("grep")):
result_lscpu = subprocess.run(["lscpu"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
result = subprocess.run(["grep", "-v", "Vulner"], input=result_lscpu.stdout,
stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
if result.returncode == 0:
lscpu_info = result.stdout

return (uname_info, lscpu_info)
return uname_info


def render_reference_results_info(
archive_name: str,
arguments_used: SystemtestArguments,
time: str):
uname, lscpu = get_machine_informations()
uname = get_machine_information()
render_dict = {
'arguments': arguments_used.arguments,
'archive_name': archive_name,
'time': time,
'uname': uname,
'lscpu': lscpu,
}

jinja_env = Environment(loader=FileSystemLoader(PRECICE_TESTS_DIR))
template = jinja_env.get_template("reference-results-metadata.txt.template")
template = jinja_env.get_template("reference-results-metadata.md.template")
return template.render(render_dict)


Expand Down
17 changes: 17 additions & 0 deletions tools/tests/reference-results-metadata.md.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!---
This file has been generated by the generate_reference_results.py script and should not be manually modified
-->

# Reference results

- Archive: `{{ archive_name }}`
- Generated at: `{{ time }}`
- Host: `{{ uname }}`

## System tests arguments used to generate the results

| name | value |
| --- | --- |
{% for name,value in arguments.items() -%}
| `{{ name }}` | `{{ value }}` |
{% endfor -%}
33 changes: 0 additions & 33 deletions tools/tests/reference-results-metadata.txt.template

This file was deleted.