-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cli: include options now accept paths in next argument, enabling ~ su…
…bstitution old syntax "-I~/path/" -> this is ignored by the shell, so "~" is not substituted with $HOME, because it's one string new syntax: "-I ~/path/" -> shell will treat ~/path as individual string and substitute the ~ (if it does that usually for you) Also the sjasmplus will now check all include paths before starting assembling and report if some can't be opened. And it reports if some starts with literal "~" (fopen will not substitute that, so if shell didn't before starting sjasmplus, report it as error). OLD SYNTAX STILL WORKS (and it's not going to be removed any time soon, if ever), but docs and --help will suggest the new syntax only.
- Loading branch information
Showing
6 changed files
with
87 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
14 changes: 14 additions & 0 deletions
14
tests/test build script and options/include_paths/tilde.asm
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
; testing multiple new changes in v1.21.0: | ||
; - include path options (i, I, inc) now can be provided with path by next following CLI argument, ie. "-I dir/" | ||
; (this allows the shell to expand ~/ paths to full path) | ||
; - include path literally starting with "~" will be reported with hint to read docs (shell didn't expand it) | ||
; - include path which can't be initially opened will be reported in error (missing dir?) | ||
; | ||
; (test is not testing if the shell did correctly expand "~" in normal use case, because it's not known | ||
; how the test enviroment is set up, if it has $HOME and if it is related to running tests - leap of faith) | ||
; | ||
; (oh, it does not substitute it from test runner when provided in .options file any way... strange, but it's fine for this test) | ||
; | ||
|
||
INCLUDE "tilde.i.asm" ; verify the include path works | ||
INCLUDE <tilde.i.asm> |
37 changes: 37 additions & 0 deletions
37
tests/test build script and options/include_paths/tilde.msglst
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
error: no include path found in: -i | ||
error: no include path found in: --inc= | ||
error: include path starts with ~ (check docs): ~/tilde3 | ||
error: include path not found: /dev/null/er4 | ||
error: include path not found: /dev/null/er3 | ||
error: include path not found: /dev/null/er2 | ||
error: include path not found: /dev/null/er1 | ||
error: include path starts with ~ (check docs): ~/tilde2 | ||
error: include path starts with ~ (check docs): ~/tilde1 | ||
# file opened: tilde.asm | ||
1 0000 ; testing multiple new changes in v1.21.0: | ||
2 0000 ; - include path options (i, I, inc) now can be provided with path by next following CLI argument, ie. "-I dir/" | ||
3 0000 ; (this allows the shell to expand ~/ paths to full path) | ||
4 0000 ; - include path literally starting with "~" will be reported with hint to read docs (shell didn't expand it) | ||
5 0000 ; - include path which can't be initially opened will be reported in error (missing dir?) | ||
6 0000 ; | ||
7 0000 ; (test is not testing if the shell did correctly expand "~" in normal use case, because it's not known | ||
8 0000 ; how the test enviroment is set up, if it has $HOME and if it is related to running tests - leap of faith) | ||
9 0000 ; | ||
10 0000 ; (oh, it does not substitute it from test runner when provided in .options file any way... strange, but it's fine for this test) | ||
11 0000 ; | ||
12 0000 | ||
13 0000 INCLUDE "tilde.i.asm" ; verify the include path works | ||
# file opened: tilde/tilde.i.asm | ||
1+ 0000 ASSERT 1 | ||
2+ 0000 | ||
# file closed: tilde/tilde.i.asm | ||
14 0000 INCLUDE <tilde.i.asm> | ||
# file opened: tilde/tilde.i.asm | ||
1+ 0000 ASSERT 1 | ||
2+ 0000 | ||
# file closed: tilde/tilde.i.asm | ||
15 0000 | ||
# file closed: tilde.asm | ||
|
||
Value Label | ||
------ - ----------------------------------------------------------- |
1 change: 1 addition & 0 deletions
1
tests/test build script and options/include_paths/tilde.options
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
-I~/tilde1 --inc=~/tilde2 -I/dev/null/er1 --inc=/dev/null/er2 -i tilde/ --inc= tilde/ -I /dev/null/er3 --inc= /dev/null/er4 -i ~/tilde3 -i --inc= --i8080 |
1 change: 1 addition & 0 deletions
1
tests/test build script and options/include_paths/tilde/tilde.i.asm
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ASSERT 1 |
43a2c8b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ped7g This commit breaks ~490 test on my local build (GCC and MSVC):
43a2c8b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, I know, it breaks also here in the CI.
But only in windows, so not sure if it's worth fixing... 🤷♂️
(just joking... maybe... I haven't yet looked into it, seems like quick check for directory existence by
fopen("directory_name", "r") + fclose()
does not work in windows, so I will have to search for some hint why is that and if there's anything possible to do about it, or if there's better way to check for include path existence)thanks for making sure I'm aware, would be very helpful if it would not fail on github CI.
43a2c8b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other option is to skip path check under windows, but that means the test of the feature would have to be skipped too, etc... I would prefer to figure out how to write it in universal way. I just find very annoying the
fopen
of directory fails, didn't expect that, nor can I imagine any sane reason why is it like that.43a2c8b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, after quite some googling I think the least annoying option for me is just to give up and go C++17 and use
std::filesystem
instead of all these posix-like hacks (I somehow did remember windows being more POSIX compliant/friendly, turns out it was less than I assumed and pretty much abandoned by now).If there wouldn't be long history of sjasmplus supporting windows, I would so just drop the support right now, there's always some issue with it whenever I develop something new, such a crap OS.
43a2c8b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Track #240 for fix (or just track build status on github). But if the C++17 is solution, it may take some time until all settles down, meanwhile "master" on github is non-windows-only.