Skip to content

Commit

Permalink
chore: add requirements and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rjaegers committed Oct 26, 2023
1 parent aa286a7 commit 927df0c
Show file tree
Hide file tree
Showing 33 changed files with 170 additions and 36 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- name: Run Tests
run: |
set -Eeuo pipefail
docker run --rm --mount type=bind,src="$(pwd)/specification/requirements/tests/assets",dst=/ws -w /ws ${{ github.repository }}:test bats --formatter junit testsuite.bats | tee test-report.xml
docker run --rm --mount type=bind,src="$(pwd)/tests",dst=/ws -w /ws ${{ github.repository }}:test bats --formatter junit testsuite.bats | tee test-report.xml
- uses: EnricoMi/publish-unit-test-result-action@ca89ad036b5fcd524c1017287fb01b5139908408 # v2.11.0
if: always()
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/verify-specification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ jobs:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- run: |
pip install doorstop==3.0b4
doorstop >> "$GITHUB_STEP_SUMMARY"
doorstop -e 2>> "$GITHUB_STEP_SUMMARY"
2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"command": "bats",
"args": ["testsuite.bats"],
"options": {
"cwd": "${workspaceFolder}/test"
"cwd": "${workspaceFolder}/tests"
},
"problemMatcher": {
"owner": "bats",
Expand Down
21 changes: 21 additions & 0 deletions specification/requirements/HEAD-1.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
active: true
derived: false
level: 1.0
links: []
normative: false
ref: ''
reviewed: XYLWU-Hs44a06GH7ROEbzshG7qwQoerFvs4kHZ5ZXxw=
---

# Introduction

This document describes the requirements for amp-devcontainer.

## Abstract

amp-devcontainer is a [devcontainer](https://containers.dev/) tailored towards modern C++ development.

## Definitions of key words

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC 2119](https://www.rfc-editor.org/rfc/rfc2119).
21 changes: 21 additions & 0 deletions specification/requirements/HEAD-2.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
active: true
derived: false
level: 2.0
links: []
normative: false
ref: ''
reviewed: NGwtZc9fjLTn_jPUJIaBlnRaPoeXCrhpDtoTutuvI_o=
---

# Requirements

This document describes the requirements for amp-devcontainer.

## Abstract

amp-devcontainer is a [devcontainer](https://containers.dev/) tailored towards modern C++ development.

## Definitions of key words

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC 2119](https://www.rfc-editor.org/rfc/rfc2119).
13 changes: 13 additions & 0 deletions specification/requirements/HEAD-2.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
active: true
derived: false
level: 2.1.0
links: []
normative: false
ref: ''
reviewed: 6nNXJvAjfy6ZFiOHZUk6pAYIH6s354g9yKW7Nlg4sBQ=
---

# Compilation

This chapter list the requirements that pertain to compilation.
11 changes: 6 additions & 5 deletions specification/requirements/REQ-0001.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
---
active: true
derived: false
level: 1.0
level: 2.1.1
links: []
normative: true
ref: ''
reviewed: YlXqzBrdPVyJ1kOTSXb5BVd0U3qRt39jT_lcpotaxh8=
reviewed: BahQmI-3t190oidQmtYsgRnqsF5ZInkZITtpW1PvQgY=
---

**amp-devcontainer __shall__ be able to compile source-code into a working executable**
# Host compilation

**amp-devcontainer *SHALL* be able to compile source-code into a working executable**

Compiling source-code into working executables, able to run inside the container, can be necessary in several scenarios e.g.
- When targeting the container host system and architecture
- When running tests inside the container
- When building plug-ins, extensions, code generators, or other additional tools
- When building plug-ins, extensions, code generators, or other additional tools that need to run inside the container
38 changes: 38 additions & 0 deletions specification/tests/HEAD-1.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
active: true
derived: false
level: 1.0
links: []
normative: false
ref: ''
reviewed: BQb72tLqNOlSKhoixy2-c7fRw2CcinT4qeWWv7gOSms=
---

# Purpose

This document describes the test cases to be executed as part of the verification of amp-devcontainer.

``` {.sh file=tests/testsuite.bats}
#!/usr/bin/env bats

setup() {
#!/usr/bin/env bats
<<setup>>
}
teardown() {
#!/usr/bin/env bats
<<teardown>>
}
<<testcase>>
```
``` {.sh #setup}
load '/usr/local/bats-support/load'
load '/usr/local/bats-assert/load'
```
``` {.sh #teardown}
rm -rf build
```
13 changes: 13 additions & 0 deletions specification/tests/HEAD-2.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
active: true
derived: false
level: 2.0
links: []
normative: false
ref: ''
reviewed: rLndHKdsx6QMzsyN_INI_Sil5SClUFemu3pBDzOri48=
---

# Test cases

This chapter contains a description and implementation of automated test cases used to verify the requirements of amp-devcontainer.
15 changes: 11 additions & 4 deletions specification/tests/TEST-0001.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
---
active: true
derived: false
level: 1.0
level: 2.1
links:
- REQ-0001: YlXqzBrdPVyJ1kOTSXb5BVd0U3qRt39jT_lcpotaxh8=
- REQ-0001: BahQmI-3t190oidQmtYsgRnqsF5ZInkZITtpW1PvQgY=
normative: true
ref: ''
reviewed: 7TzxCCfQzn1Pc7-N6_G-zn3G43Iw6fccUg8flhUq42o=
references:
- keyword: TEST-0001
path: tests/testsuite.bats
type: file
reviewed: -ARwwSIY4W0KIWljxJ_o4qFstQkH79Jo_B_X0Ov_rTM=
---

# Test host compilation

``` {.sh #testcase}
"valid code input should result in working executable using host compiler" {
# bats test_tags=TC:TEST-0001
@test "valid code input should result in working executable using host compiler" {
run cmake --preset gcc
assert_success

Expand Down
9 changes: 9 additions & 0 deletions specification/tests/TEST-0002.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
active: true
derived: false
level: 2.2
links: []
normative: true
ref: ''
reviewed: null
---
24 changes: 0 additions & 24 deletions specification/tests/assets/TESTSUITE.md

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
35 changes: 35 additions & 0 deletions tests/testsuite.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env bats
# ~/~ begin <<specification/tests/HEAD-1.0.md#tests/testsuite.bats>>[init]

setup() {
#!/usr/bin/env bats
#!/usr/bin/env bats
# ~/~ begin <<specification/tests/HEAD-1.0.md#setup>>[init]
load '/usr/local/bats-support/load'
load '/usr/local/bats-assert/load'
# ~/~ end
}

teardown() {
#!/usr/bin/env bats
#!/usr/bin/env bats
# ~/~ begin <<specification/tests/HEAD-1.0.md#teardown>>[init]
rm -rf build
# ~/~ end
}

# ~/~ begin <<specification/tests/TEST-0001.md#testcase>>[init]
# bats test_tags=TC:TEST-0001
@test "valid code input should result in working executable using host compiler" {
run cmake --preset gcc
assert_success

run cmake --build --preset gcc
assert_success

run build/gcc/gcc/test-gcc
assert_success
assert_output "Hello World!"
}
# ~/~ end
# ~/~ end

0 comments on commit 927df0c

Please sign in to comment.