fix: do178 --dal invalid value returns exit 2, accept DAL-A format (v0.5.26)#36
Merged
Conversation
…0.5.26) cfusa do178 --dal with an unrecognized DAL now returns exit 2 (usage error) instead of exit 1. Also accepts "DAL-A"/"DAL-B"/... prefix format in addition to the short "a"/"b"/... form; previously DAL-A was misread as DAL-D (first char 'D'). Parity with go-FuSa TestRunDo178_InvalidDALv2. Signed-off-by: Matt Jones <matt@jellybaby.com> Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Matt Jones <47545907+SoundMatt@users.noreply.github.com>
| const char *dal_key = dal_s; | ||
| if ((dal_key[0]|0x20)=='d' && (dal_key[1]|0x20)=='a' && | ||
| (dal_key[2]|0x20)=='l' && dal_key[3]=='-') | ||
| dal_key += 4; /* skip "DAL-" prefix */ |
| //cfusa:test REQ-DO178-DAL001 | ||
| void test_do178_invalid_dal_returns_2(void) | ||
| { | ||
| char *argv[] = {"cfusa", "--dir", CMD2_DIR, "--dal", "DAL-Z", NULL}; |
| //cfusa:test REQ-DO178-DAL001 | ||
| void test_do178_dal_prefix_format_accepted(void) | ||
| { | ||
| char *argv[] = {"cfusa", "--dir", CMD2_DIR, "--dal", "DAL-A", NULL}; |
| /* Determine DAL level — accept "a" or "DAL-A" format (case-insensitive) */ | ||
| const char *dal_key = dal_s; | ||
| if ((dal_key[0]|0x20)=='d' && (dal_key[1]|0x20)=='a' && | ||
| (dal_key[2]|0x20)=='l' && dal_key[3]=='-') |
| /* Determine DAL level — accept "a" or "DAL-A" format (case-insensitive) */ | ||
| const char *dal_key = dal_s; | ||
| if ((dal_key[0]|0x20)=='d' && (dal_key[1]|0x20)=='a' && | ||
| (dal_key[2]|0x20)=='l' && dal_key[3]=='-') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
cfusa do178 --dal DAL-Znow returns exit 2 (usage error); was returning exit 1 (gate fail)a|b|c|dandDAL-A|DAL-B|DAL-C|DAL-Dformat (case-insensitive); previouslyDAL-Awas silently misread as DAL-DTestRunDo178_InvalidDALv2Test plan
--dal DAL-Z→ exit 2--dal DAL-A→ exit != 2