diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 00000000..2516bf1f --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,26 @@ +name: Tests CI + +on: + push: + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + container: + image: ghcr.io/pandablocks/pandablocks-dev-container:latest + volumes: + - ${{ github.workspace }}/build:/build + + steps: + - name: Checkout Source + uses: actions/checkout@v2 + with: + path: PandABlocks-server + + - name: Run the server regression tests + run: | + cd PandABlocks-server + ln -s CONFIG.example CONFIG + make sim_server + make -C tests diff --git a/server/sim_hardware.c b/server/sim_hardware.c index 5053d7bd..4e98b877 100644 --- a/server/sim_hardware.c +++ b/server/sim_hardware.c @@ -250,15 +250,15 @@ error__t hw_long_table_write( { ASSERT_OK(0 <= block_id && block_id < (int) block_id_count); struct table_block *block = &block_id_table[block_id]; + size_t nbytes = length * sizeof(uint32_t); - memcpy(block->data, data, length); - - uint32_t words = (uint32_t) length / sizeof(uint32_t); + memcpy(block->data, data, nbytes); + ASSERT_OK(length == (uint32_t) length); WITH_MUTEX(mutex) handle_error( write_command_int('T', - block->block_base, block->number, 0, words) ?: - write_all(block->data, length)); + block->block_base, block->number, 0, (uint32_t) length) ?: + write_all(block->data, nbytes)); return ERROR_OK; } diff --git a/tests/transcript b/tests/transcript index f3b0bbd6..f367132e 100644 --- a/tests/transcript +++ b/tests/transcript @@ -231,14 +231,14 @@ < PCOMP2.TABLE.LENGTH? > OK =3 -< PCOMP2.TABLE<< +< PCOMP2.TABLE< < 1 2 3 4 5 6 7 8 < 9 < > OK < PCOMP2.TABLE.LENGTH? -> OK =12 +> OK =9 < SEQ2.TABLE< < 1 2 3 4 5 6 7 8 @@ -246,11 +246,6 @@ < > ERR Table write is not a whole number of rows -< SEQ2.TABLE< -< 1 2 3 4 5 6 7 8 -< -> OK - < SEQ2.TABLE OK -< SEQ2.TABLE<< -< 1 2 3 4 5 6 7 8 -< -> OK - < SEQ2.TABLE? > !3891817943 > !16055470 > !964615029 > !4046827 +> . + +< SEQ2.TABLE< +< 1 2 3 4 5 6 7 8 +< +> OK + +< SEQ2.TABLE? > !1 > !2 > !3 @@ -320,7 +318,7 @@ < PCOMP2.TABLE OK +# Polled attributes changes are cleared by reading them +< *CHANGES.ATTR? +> !PCOMP1.TABLE.QUEUED_LINES=0 +> !PCOMP2.TABLE.QUEUED_LINES=0 +> !PCOMP3.TABLE.QUEUED_LINES=0 +> !PCOMP4.TABLE.QUEUED_LINES=0 +> !PGEN1.TABLE.QUEUED_LINES=0 +> !PGEN2.TABLE.QUEUED_LINES=0 +> !SEQ1.TABLE.QUEUED_LINES=0 +> !SEQ2.TABLE.QUEUED_LINES=0 +> !SEQ3.TABLE.QUEUED_LINES=0 +> !SEQ4.TABLE.QUEUED_LINES=0 +> . + +# TODO: remove QUEUED_LINES entries when pull request #71 get merged < *CHANGES.ATTR? +> !PCOMP1.TABLE.QUEUED_LINES=0 +> !PCOMP2.TABLE.QUEUED_LINES=0 +> !PCOMP3.TABLE.QUEUED_LINES=0 +> !PCOMP4.TABLE.QUEUED_LINES=0 +> !PGEN1.TABLE.QUEUED_LINES=0 +> !PGEN2.TABLE.QUEUED_LINES=0 +> !SEQ1.TABLE.QUEUED_LINES=0 +> !SEQ2.TABLE.QUEUED_LINES=0 +> !SEQ3.TABLE.QUEUED_LINES=0 +> !SEQ4.TABLE.QUEUED_LINES=0 > . < INENC2.VAL.CAPTURE=Mean @@ -504,10 +527,10 @@ > ERR Time setting out of range < PULSE1.DELAY.RAW=3 -> ERR Value too small +> OK < PULSE1.DELAY=2e-8 -> ERR Value too small +> OK # Table support < SEQ.TABLE.*? @@ -516,6 +539,8 @@ > !ROW_WORDS > !LENGTH > !FIELDS +> !QUEUED_LINES +> !MODE > !INFO > .