-
Notifications
You must be signed in to change notification settings - Fork 604
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
js: semgrep js pattern testing #8902
Merged
Merged
Changes from all commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
66f023e
More tests
ajbt200128 c3e302f
Unit_engine now running
ajbt200128 4a4037f
Re add Unit_engine
ajbt200128 9951001
Better error printing
ajbt200128 3233d10
Fix python parser
ajbt200128 b906280
Fix PCRE
ajbt200128 4c2ccad
Fix individual tests
ajbt200128 18d7355
MORE FIXES!!!! Fresh off the stove
ajbt200128 b4d0d28
Fix tests
ajbt200128 51dd5ac
Fix vue
ajbt200128 f4af37d
Torvalds moment: if it breaks userspace its a bug!
ajbt200128 fcfa299
Fix stack overflow issue :(
ajbt200128 dad102e
Ignore weird logging error
ajbt200128 af17296
camel strings > js strings IG
ajbt200128 1c20834
Real ocaml js string fixes fr fr
ajbt200128 babf300
update opam file
tpetr 8d85acc
Merge branch 'develop' into austin/semgrep-js-pattern-testing
tpetr e27d60c
fix bogus merge
tpetr f0ad649
Revert "update opam file"
tpetr d209fa1
temporarily disable golang test that triggers jsoo int overflow
tpetr bfeb8e6
needed caml_jsstring_of_string impl
tpetr 591a66b
update js parsers to use official semgrep test fixtures + some minor …
tpetr fc7e497
fix engine test
tpetr 824cc82
move test semgrep js into build-test-javascript
tpetr adf6583
Merge branch 'develop' into austin/semgrep-js-pattern-testing
tpetr df38e47
fix engine getLangs()
tpetr 9ed7d78
delete printfs from Entropy.ml
tpetr 114f3a0
fix comment
tpetr 9ebeaaa
js e2e
tpetr 267a80f
try bumping version of semgrep in jsonnet precommit
tpetr 248f69e
fix jsoo build upload
tpetr 3b891c7
temporarily skip failing C test
tpetr 9caeca6
jsoo 5.4.0
tpetr fa018c4
bump ocaml-layer image
tpetr 178aae2
non-zero exit if tests fail
tpetr 5f45ce4
workflows needed a dep for make
tpetr 60ea1a4
Merge branch 'develop' into austin/semgrep-js-pattern-testing
tpetr cc9d1bb
Merge branch 'develop' into austin/semgrep-js-pattern-testing
tpetr 32dcfff
PR feedback
tpetr d83208e
more comments
tpetr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 |
---|---|---|
|
@@ -13,8 +13,8 @@ test: | |
cd libpcre; $(MAKE) test | ||
cd libyaml; $(MAKE) test | ||
cd engine; $(MAKE) test | ||
cd languages; $(MAKE) test # These are easily parallelizable | ||
#cd tests; $(MAKE) # This is really slow for some reason :( | ||
cd languages; $(MAKE) test | ||
cd tests; $(MAKE) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe better to be consistent and use make test for the tests/ dir too. |
||
|
||
.PHONY: e2e | ||
e2e: engine languages | ||
|
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
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,22 @@ | ||
EMCC_DEFAULTS = \ | ||
-sALLOW_MEMORY_GROWTH=1 \ | ||
-sEXPORTED_RUNTIME_METHODS=UTF8ToString,stringToUTF8,stringToAscii,lengthBytesUTF8,getValue,setValue,intArrayFromString,writeArrayToMemory \ | ||
-sMODULARIZE | ||
|
||
include ../libyaml/Makefile.include | ||
include ../libpcre/Makefile.include | ||
|
||
../libyaml/dist/libyaml.o: | ||
$(MAKE) -C ../libyaml dist/libyaml.o | ||
|
||
../libpcre/dist/libpcre.a: | ||
$(MAKE) -C ../libpcre dist/libpcre.a | ||
|
||
dist/semgrep-engine.js dist/semgrep-engine.wasm: ../libyaml/dist/libyaml.o ../libpcre/dist/libpcre.a | ||
tpetr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
mkdir -p dist | ||
emcc \ | ||
-O3 \ | ||
$^ \ | ||
$(EMCC_DEFAULTS) \ | ||
-sEXPORTED_FUNCTIONS=_malloc,_free,$(YAML_EXPORTED_METHODS),$(PCRE_EXPORTED_METHODS) \ | ||
-o $(word 1,$@) |
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
File renamed without changes.
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 |
---|---|---|
@@ -1,23 +1,10 @@ | ||
const { ParserFactory } = require("../dist/index.cjs"); | ||
|
||
const parserPromise = ParserFactory(); | ||
const { createParser, testParser } = require("../../shared/parser"); | ||
|
||
const LANG = "bash"; | ||
const EXPECTED_LANGS = [LANG]; | ||
|
||
test("getLangs", async () => { | ||
const parser = await parserPromise; | ||
expect(parser.getLangs()).toEqual(EXPECTED_LANGS); | ||
}); | ||
|
||
test("it parses a pattern", async () => { | ||
const parser = await parserPromise; | ||
const pattern = parser.parsePattern(false, LANG, "echo $X"); | ||
expect(typeof pattern).toEqual("object"); | ||
}); | ||
describe(`${LANG} parser`, () => { | ||
const parserPromise = createParser(`${__dirname}/../dist/index.cjs`); | ||
|
||
test("it parses a file", async () => { | ||
const parser = await parserPromise; | ||
const target = parser.parseTarget(LANG, "tests/test.sh"); | ||
expect(typeof target).toEqual("object"); | ||
testParser(LANG, parserPromise); | ||
}); |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,9 @@ | ||
const { ParserFactory } = require("../dist/index.cjs"); | ||
|
||
const parserPromise = ParserFactory(); | ||
const { createParser, testParser } = require("../../shared/parser"); | ||
|
||
const LANG = "c"; | ||
const EXPECTED_LANGS = [LANG]; | ||
|
||
test("getLangs", async () => { | ||
const parser = await parserPromise; | ||
expect(parser.getLangs()).toEqual(EXPECTED_LANGS); | ||
}); | ||
|
||
test("it parses a pattern", async () => { | ||
const parser = await parserPromise; | ||
const pattern = parser.parsePattern(false, LANG, "printf(...)"); | ||
expect(typeof pattern).toEqual("object"); | ||
}); | ||
describe(`${LANG} parser`, () => { | ||
const parserPromise = createParser(`${__dirname}/../dist/index.cjs`); | ||
|
||
test("it parses a file", async () => { | ||
const parser = await parserPromise; | ||
const target = parser.parseTarget(LANG, "tests/test.c"); | ||
expect(typeof target).toEqual("object"); | ||
testParser(LANG, parserPromise); | ||
}); |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,24 +1,9 @@ | ||
const { ParserFactory } = require("../dist/index.cjs"); | ||
|
||
const parserPromise = ParserFactory(); | ||
const { createParser, testParser } = require("../../shared/parser"); | ||
|
||
const LANG = "cairo"; | ||
const EXPECTED_LANGS = [LANG]; | ||
|
||
test("getLangs", async () => { | ||
const parser = await parserPromise; | ||
expect(parser.getLangs()).toEqual(EXPECTED_LANGS); | ||
}); | ||
|
||
// TODO | ||
// test("it parses a pattern", async () => { | ||
// const parser = await parserPromise; | ||
// const pattern = parser.parsePattern(false, LANG, "sum by (foo) $X"); | ||
// expect(typeof pattern).toEqual("object"); | ||
// }); | ||
describe(`${LANG} parser`, () => { | ||
const parserPromise = createParser(`${__dirname}/../dist/index.cjs`); | ||
|
||
test("it parses a file", async () => { | ||
const parser = await parserPromise; | ||
const target = parser.parseTarget(LANG, "tests/test.cairo"); | ||
expect(typeof target).toEqual("object"); | ||
testParser(LANG, parserPromise); | ||
}); |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,23 +1,9 @@ | ||
const { ParserFactory } = require("../dist/index.cjs"); | ||
|
||
const parserPromise = ParserFactory(); | ||
const { createParser, testParser } = require("../../shared/parser"); | ||
|
||
const LANG = "cpp"; | ||
const EXPECTED_LANGS = [LANG]; | ||
|
||
test("getLangs", async () => { | ||
const parser = await parserPromise; | ||
expect(parser.getLangs()).toEqual(EXPECTED_LANGS); | ||
}); | ||
|
||
test("it parses a pattern", async () => { | ||
const parser = await parserPromise; | ||
const pattern = parser.parsePattern(false, LANG, "std::cout << $X"); | ||
expect(typeof pattern).toEqual("object"); | ||
}); | ||
describe(`${LANG} parser`, () => { | ||
const parserPromise = createParser(`${__dirname}/../dist/index.cjs`); | ||
|
||
test("it parses a file", async () => { | ||
const parser = await parserPromise; | ||
const target = parser.parseTarget(LANG, "tests/test.cpp"); | ||
expect(typeof target).toEqual("object"); | ||
testParser(LANG, parserPromise); | ||
}); |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
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.
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.
don't need this line here; the make test above already run the tests under js/tests now.