mirror of https://github.com/janet-lang/janet
Add some tests for the amalgamated source/
Adds tests to Makefile and CI on Poisx platforms.
This commit is contained in:
parent
b5e6c0b8fc
commit
a303704a7d
|
@ -9,3 +9,4 @@ tasks:
|
||||||
gmake test CC=gcc
|
gmake test CC=gcc
|
||||||
sudo gmake install CC=gcc
|
sudo gmake install CC=gcc
|
||||||
gmake test-install CC=gcc
|
gmake test-install CC=gcc
|
||||||
|
gmake test-amalg CC=gcc
|
||||||
|
|
|
@ -8,3 +8,4 @@ tasks:
|
||||||
gmake test
|
gmake test
|
||||||
doas gmake install
|
doas gmake install
|
||||||
gmake test-install
|
gmake test-install
|
||||||
|
gmake test-amalg
|
||||||
|
|
|
@ -4,6 +4,7 @@ script:
|
||||||
- make test
|
- make test
|
||||||
- sudo make install
|
- sudo make install
|
||||||
- make test-install
|
- make test-install
|
||||||
|
- make test-amalg
|
||||||
- make build/janet-${TRAVIS_TAG}-${TRAVIS_OS_NAME}.tar.gz
|
- make build/janet-${TRAVIS_TAG}-${TRAVIS_OS_NAME}.tar.gz
|
||||||
compiler:
|
compiler:
|
||||||
- clang
|
- clang
|
||||||
|
|
10
Makefile
10
Makefile
|
@ -304,6 +304,16 @@ install: $(JANET_TARGET) build/version.txt
|
||||||
test-install:
|
test-install:
|
||||||
cd test/install && rm -rf build && janet build && janet build
|
cd test/install && rm -rf build && janet build && janet build
|
||||||
|
|
||||||
|
build/embed_janet.o: build/janet.c $(JANET_HEADERS)
|
||||||
|
$(CC) $(CFLAGS) -c $< -o $@
|
||||||
|
build/embed_main.o: test/amalg/main.c $(JANET_HEADERS)
|
||||||
|
$(CC) $(CFLAGS) -c $< -o $@
|
||||||
|
build/embed_test: build/embed_janet.o build/embed_main.o
|
||||||
|
$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $^ $(CLIBS)
|
||||||
|
|
||||||
|
test-amalg: build/embed_test
|
||||||
|
./build/embed_test
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
-rm $(BINDIR)/../$(JANET_TARGET)
|
-rm $(BINDIR)/../$(JANET_TARGET)
|
||||||
-rm -rf $(INCLUDEDIR)
|
-rm -rf $(INCLUDEDIR)
|
||||||
|
|
|
@ -239,11 +239,11 @@ void janetc_copy(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* Process: src -> near -> dest */
|
/* Process: src -> near -> dest */
|
||||||
int32_t near = janetc_allocnear(c, JANETC_REGTEMP_3);
|
int32_t nearreg = janetc_allocnear(c, JANETC_REGTEMP_3);
|
||||||
janetc_movenear(c, near, src);
|
janetc_movenear(c, nearreg, src);
|
||||||
janetc_moveback(c, dest, near);
|
janetc_moveback(c, dest, nearreg);
|
||||||
/* Cleanup */
|
/* Cleanup */
|
||||||
janetc_regalloc_freetemp(&c->scope->ra, near, JANETC_REGTEMP_3);
|
janetc_regalloc_freetemp(&c->scope->ra, nearreg, JANETC_REGTEMP_3);
|
||||||
|
|
||||||
}
|
}
|
||||||
/* Instruction templated emitters */
|
/* Instruction templated emitters */
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2019 Calvin Rose
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to
|
||||||
|
* deal in the Software without restriction, including without limitation the
|
||||||
|
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||||
|
* sell copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
|
* IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* A simple client for checking if the amalgamated Janet source compiles
|
||||||
|
* correctly. */
|
||||||
|
|
||||||
|
#include <janet.h>
|
||||||
|
|
||||||
|
int main(int argc, const char *argv[]) {
|
||||||
|
(void) argc;
|
||||||
|
(void) argv;
|
||||||
|
janet_init();
|
||||||
|
JanetTable *env = janet_core_env(NULL);
|
||||||
|
janet_dostring(env, "(print `hello, world!`)", "main", NULL);
|
||||||
|
janet_deinit();
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue