Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Current release barfs on missing 'BUFFER:' #31

Closed
frenchie68 opened this issue Mar 8, 2022 · 8 comments
Closed

Current release barfs on missing 'BUFFER:' #31

frenchie68 opened this issue Mar 8, 2022 · 8 comments

Comments

@frenchie68
Copy link

mit@kir4:/src$ git clone git@github.com:gerryjackson/forth2012-test-suite.git
Cloning into 'forth2012-test-suite'...
remote: Enumerating objects: 408, done.
remote: Counting objects: 100% (20/20), done.
remote: Compressing objects: 100% (20/20), done.
remote: Total 408 (delta 5), reused 0 (delta 0), pack-reused 388
Receiving objects: 100% (408/408), 184.33 KiB | 898.00 KiB/s, done.
Resolving deltas: 100% (215/215), done.
mit@kir4:
/src$ ls
as68k gcc-8.3.0.tar.xz mpfr-4.0.2.tar.xz
as68k.zip gmp-6.1.2.tar.xz vasm
binutils-2.32.tar.xz isl-0.20.tar.xz viewvc
crosstool-ng-1.24.0 jpeg2ps VolksForth
elf2flt-git-7e33f28d.tar.bz2 minicom zlib-1.2.11.tar.xz
forth2012-test-suite mpc-1.1.0.tar.gz
mit@kir4:/src$ cd *suite
mit@kir4:
/src/forth2012-test-suite$ ls
doc prelimtest.md README.md src
mit@kir4:/src/forth2012-test-suite$ cd src
mit@kir4:
/src/forth2012-test-suite/src$ ls
blocktest.fth exceptiontest.fth prelimtest.fth tester.fr
coreexttest.fth facilitytest.fth required-helper1.fth toolstest.fth
core.fr filetest.fth required-helper2.fth ttester.fs
coreplustest.fth fp runtests.fth utilities.fth
doubletest.fth localstest.fth searchordertest.fth
errorreport.fth memorytest.fth stringtest.fth
mit@kir4:~/src/forth2012-test-suite/src$ ~/gf*/gf*/gforth
Gforth 0.7.3, Copyright (C) 1995-2008 Free Software Foundation, Inc.
Gforth comes with ABSOLUTELY NO WARRANTY; for details type license' Type bye' to exit
include runtests.fth
Running ANS Forth and Forth 2012 test programs, version 0.13.4

CR CR SOURCE TYPE ( Preliminary test ) CR
SOURCE ( These lines test SOURCE, TYPE, CR and parenthetic comments ) TYPE CR
( The next line of output should be blank to test CR ) SOURCE TYPE CR CR

( Pass #1: testing 0 >IN +! ) 0 >IN +! SOURCE TYPE CR
( Pass #2: testing 1 >IN +! ) 1 >IN +! xSOURCE TYPE CR
( Pass #3: testing 1+ ) 1 1+ >IN +! xxSOURCE TYPE CR
( Pass #4: testing @ ! BASE ) 0 1+ 1+ BASE ! BASE @ >IN +! xxSOURCE TYPE CR
( Pass #5: testing decimal BASE ) BASE @ >IN +! xxxxxxxxxxSOURCE TYPE CR
( Pass #6: testing : ; ) : .SRC SOURCE TYPE CR ; 6 >IN +! xxxxxx.SRC
( Pass #7: testing number input ) 19 >IN +! xxxxxxxxxxxxxxxxxxx.SRC
( Pass #8: testing VARIABLE ) VARIABLE Y 2 Y ! Y @ >IN +! xx.SRC
( Pass #9: testing WORD COUNT ) 5 MSG abcdef) Y ! Y ! >IN +! xxxxx.SRC
( Pass #10: testing WORD COUNT ) MSG ab) >IN +! xxY ! .SRC
Pass #11: testing WORD COUNT .MSG
Pass #12: testing = returns all 1's for true
Pass #13: testing = returns 0 for false
Pass #14: testing -1 interpreted correctly
Pass #15: testing 2*
Pass #16: testing 2*
Pass #17: testing AND
Pass #18: testing AND
Pass #19: testing AND
Pass #20: testing ?F~ ?~~ Pass Error
Pass #21: testing ?~
Pass #22: testing EMIT
Pass #23: testing S"

Results:

Pass messages #1 to #23 should be displayed above
and no error messages

0 tests failed out of 57 additional tests

--- End of Preliminary Tests ---
redefined Error with ERROR
********************YOU SHOULD SEE THE STANDARD GRAPHIC CHARACTERS:
!"#$%&'()
+,-./0123456789:;<=>?@
ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`
abcdefghijklmnopqrstuvwxyz{|}~
YOU SHOULD SEE 0-9 SEPARATED BY A SPACE:
0 1 2 3 4 5 6 7 8 9
YOU SHOULD SEE 0-9 (WITH NO SPACES):
0123456789
YOU SHOULD SEE A-G SEPARATED BY A SPACE:
A B C D E F G
YOU SHOULD SEE 0-5 SEPARATED BY TWO SPACES:
0 1 2 3 4 5
YOU SHOULD SEE TWO SEPARATE LINES:
LINE 1
LINE 2
YOU SHOULD SEE THE NUMBER RANGES OF SIGNED AND UNSIGNED NUMBERS:
SIGNED: -8000000000000000 7FFFFFFFFFFFFFFF
UNSIGNED: 0 FFFFFFFFFFFFFFFF
*
PLEASE TYPE UP TO 80 CHARACTERS:
Abracadabra.
RECEIVED: "Abracadabra."
*redefined GDX
End of Core word set tests


You should see 2345: 2345


End of additional Core tests
redefined ?DEFTEST1
Test utilities loaded
***********redefined MA1 **
in file included from runtests.fth:17
coreexttest.fth:400: Undefined word
T{ 8 >>>BUFFER:<<< BUF:TEST -> }T
Backtrace:
$7F485E392A08 throw
$7F485E3A8C90 no.extensions
$7F485E392CC8 interpreter-notfound1

@steverpalmer
Copy link
Collaborator

Hi Francois,
Thanks for raising this issue. (It caught my eye because we have spoken before and this issue included the string "BUFFER".)

I'm looking at the Forth 2012 (Release Candidate 3) standard and it includes a description of the word "BUFFER:" in the CORE Word Set Extenstion (6.2.0825) related to adding a new word to the dictionary with a parametrized allocation of space. Note that this does not relate to the word "BUFFER" as mentioned in the title of this issue.

I've just repeated your observation that Gfroth 0.7.3 does not appear to implement this word.
It seems to me that the test-suite has worked correctly in identifying an issue with Gforth 0.7.3 against the 2012 Forth standard, though the error report is a little unfriendly.

Could you add something to describe what you think should happen in this case?

Cheers,
Steve

@frenchie68
Copy link
Author

frenchie68 commented Mar 9, 2022

Hi Steve,

Well, if the word is not defined (as it isn't in GForth 0.7.3). the forth-standard.org reference material provides a straightforward implementation for it:

[UNDEFINED] BUFFER: [IF]
: BUFFER: ( u "" -- ; -- addr )
\ Create a buffer of u address units whose address is returned at run time.
CREATE ALLOT
;
[THEN]

Of course, this implies that coreexttest.fth is run after toolstest.fth, which is not currently the case.
Another option would be to assume that BUFFER: is not supported and to inline it.

The whole point of this exercise was for me to make sure doubletest.fth is correct under GForth,
since my own implementation has a problem with:

T{ MIN-2INT MAX-2INT D< -> TRUE }T

But that's another story altogether.

Cheers.

  Francois

@steverpalmer
Copy link
Collaborator

Hi Francois,

I think you are agreeing that the issue is with the word BUFFER: not BUFFER as given in the title of this issue. I will try and fix it the title. Thank you.

Regarding BUFFER:, you are right that is it easily defined, but the point of line 400 in coreexttest.fth is to test that the definition provided by the forth implementation under-test is correct. In this case the test-suite has correctly identified that the word BUFFER: is missing from GForth v0.7.3 (though as Gerry points out in the updated README.md, it is available in GForth v0.7.9). Please note that the test-suite itself does not need or use the word BUFFER:, so there is not need for it to provide a definition; the only occurrence of BUFFER: is in the lines 398 to 403 of coreexttest.fth where is it being tested.

There are several ways that can be used to stop the missing BUFFER: halting a test run; the simplest being to comment out lines 400 to 403 of coreexttest.fth. However, in this case, GForth v0.7.3 then fails because of missing HOLDS word, (and then continues to fall-over due to other missing words). In this case, a better option might be to edit the file runtests.fth, to focus on the parts of the standard that is being worked on.

Happy debugging!

Cheers,
Steve

@steverpalmer steverpalmer changed the title Current release barfs on missing 'BUFFER' Current release barfs on missing 'BUFFER:' Mar 10, 2022
@steverpalmer
Copy link
Collaborator

steverpalmer commented Mar 10, 2022

Gerry,
A common feature of test-frameworks is to allow tests to be skipped. Today's silly idea might be:

  • create a variable to hold a flag value, say something like T-SKIPPING;
  • Use the TESTING word to reset the value to false;
  • Given the T{ word some semantics to check the T-SKIPPING flag and, if true, scan forwards (and discard) to the next }T word.

The intent is to allow users to easily flag a block of tests to be skipped. We could add another word like T-SKIP which as well as setting the T-SKIPPING flag, could provide a comment with a reason for skipping, and allow us to report on the number of skipped sections in the final summary.

Hmm...

Cheers,
Steve

@frenchie68
Copy link
Author

Hi Steve,

Is GNU Forth 0.7.9 the latest official release, i.e. sanctioned by the usual suspects (Ertl/Paysan/Jens)? If it is, I should definitely upgrade. On a topic other than BUFFER:, which I think is easy to fix, I spent almost the whole week working on doubletest.fth. I am about 80% compliant which, for an implementation that was never meant to be ANS compliant in the first place, is not so bad. Is the credit for doubletest.fth to go to Gerry Jackson as well?

Cheers.
Francois

@steverpalmer
Copy link
Collaborator

Hi Francois,

The status of GForth 0.7.9 I will leave up to the GForth website, though v0.7.9 appears to be under active development. For example, I can see commits to the head by Anton Ertl and Bernd Paysan being made yesterday.

doubletest.fth is very largely the work of Gerry; I've had nothing to do with it. There are occasional suggestions and contributions from other users of the test suite (such as #21), but I think it is fair to say that most of the work has been done by Gerry. My own contribution to the test suite is really limited to blocktest.fth.

One final thought: unless you say otherwise, I will close this issue in the near future for a couple of reasons:

Cheers,
Steve

@frenchie68
Copy link
Author

Hi Steve,

I will upgrade to GForth 0.7.9. Thank you for being a perfect gentleman!

Best regards.
Francois

@gerryjackson
Copy link
Owner

Thanks Steve for your help in responding to this issue - I'm doing some tidying up of issues and this now seems dead. As stated earlier the README covers this problem so hopefully it won't be re-raised. So I will close it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants