1
1
mirror of https://github.com/github/semantic.git synced 2024-11-24 00:42:33 +03:00

Merge pull request #495 from github/fix-test-builds

Fix builds for semantic-* tests
This commit is contained in:
Timothy Clem 2020-02-20 15:07:21 -08:00 committed by GitHub
commit 4dd1e41470
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
34 changed files with 105 additions and 97 deletions

View File

@ -52,7 +52,7 @@ jobs:
- name: Install dependencies
run: |
script/bootstrap
cabal v2-update
cabal v2-configure --project-file=cabal.project.ci --disable-optimization --enable-benchmarks --enable-tests --write-ghc-environment-files=always -j2
cabal v2-build --project-file=cabal.project.ci all --only-dependencies
@ -61,7 +61,14 @@ jobs:
cabal v2-build --project-file=cabal.project.ci
cabal v2-run --project-file=cabal.project.ci semantic:test
cabal v2-run --project-file=cabal.project.ci semantic-core:test
cabal v2-run --project-file=cabal.project.ci semantic-go:test
cabal v2-run --project-file=cabal.project.ci semantic-java:test
cabal v2-run --project-file=cabal.project.ci semantic-json:test
cabal v2-run --project-file=cabal.project.ci semantic-python:test
cabal v2-run --project-file=cabal.project.ci semantic-python:test:compiling
cabal v2-run --project-file=cabal.project.ci semantic-python:test:graphing
cabal v2-run --project-file=cabal.project.ci semantic-ruby:test
cabal v2-run --project-file=cabal.project.ci semantic-tsx:test
cabal v2-run --project-file=cabal.project.ci semantic-typescript:test
cd semantic-source; cabal v2-run --project-file=cabal.project.ci semantic-source:test; cd ..
cd semantic-source; cabal v2-run --project-file=cabal.project.ci semantic-source:doctest -- src; cd ..

View File

@ -1,4 +1,3 @@
#!/bin/bash
git submodule sync --recursive && git submodule update --init --recursive --force
cabal v2-update

View File

@ -2,6 +2,7 @@
module AST.Test
( CorpusExample(..)
, readCorpusFiles
, readCorpusFiles'
, parseCorpusFile
, testCorpus
) where
@ -22,7 +23,7 @@ import System.FilePath.Glob
import Test.Tasty
import Test.Tasty.HUnit
testCorpus :: (ByteString -> IO (Either String (t a))) -> Path.RelFile -> IO TestTree
testCorpus :: (ByteString -> IO (Either String (t a))) -> Path.AbsRelFile -> IO TestTree
testCorpus parse path = do
xs <- parseCorpusFile path
case xs of
@ -50,10 +51,15 @@ readCorpusFiles parent = do
files <- globDir1 (compile "**/*.txt") (Path.toString dir)
pure (Path.relPath <$> files)
readCorpusFiles' :: Path.AbsDir -> IO [Path.AbsRelFile]
readCorpusFiles' dir = do
files <- globDir1 (compile "**/*.txt") (Path.toString dir)
pure (Path.file <$> files)
data CorpusExample = CorpusExample { name :: String, code :: ByteString }
deriving (Eq, Show)
parseCorpusFile :: Path.RelFile -> IO (Either String [CorpusExample])
parseCorpusFile :: Path.AbsRelFile -> IO (Either String [CorpusExample])
parseCorpusFile path = do
c <- Data.ByteString.readFile (Path.toString path)
pure $ parseOnly corpusParser c

View File

@ -31,7 +31,7 @@ common haskell
, template-haskell ^>= 2.15
, text ^>= 1.2.3
, tree-sitter ^>= 0.9
, tree-sitter-go ^>= 0.5.0.0
, tree-sitter-go ^>= 0.5.0.1
ghc-options:
-Weverything
@ -63,13 +63,12 @@ test-suite test
hs-source-dirs: test
main-is: Test.hs
build-depends: base
, tree-sitter
, tree-sitter-go
, semantic-ast
, bytestring ^>= 0.10.8.2
, hedgehog >= 0.6 && <2
, pathtype ^>= 0.8.1
, text
, semantic-ast
, semantic-go
, tasty
, tasty-hedgehog
, tasty-hunit
, text

View File

@ -12,11 +12,12 @@
module Language.Go.AST
( module Language.Go.AST
, Go.getTestCorpusDir
) where
import Prelude hiding (False, Float, Integer, Rational, String, True)
import AST.GenerateSyntax
import Language.Haskell.TH.Syntax (runIO)
import qualified TreeSitter.Go as Go (getNodeTypesPath, tree_sitter_go)
import qualified TreeSitter.Go as Go (getNodeTypesPath, getTestCorpusDir, tree_sitter_go)
runIO Go.getNodeTypesPath >>= astDeclarationsForLanguage Go.tree_sitter_go

View File

@ -1,16 +1,17 @@
{-# LANGUAGE DisambiguateRecordFields, OverloadedStrings, TypeApplications #-}
module Main (main) where
import qualified System.Path as Path
import Test.Tasty
import Language.Go.Grammar
import qualified Language.Go.AST as Go
import AST.Test
import AST.Unmarshal
import qualified Language.Go.AST as Go
import Language.Go.Grammar
import qualified System.Path as Path
import Test.Tasty
main :: IO ()
main
= readCorpusFiles (Path.relDir "tree-sitter-go/vendor/tree-sitter-go/corpus")
= Path.absDir <$> Go.getTestCorpusDir
>>= readCorpusFiles'
>>= traverse (testCorpus parse)
>>= defaultMain . tests
where parse = parseByteString @Go.SourceFile @() tree_sitter_go

@ -1 +0,0 @@
Subproject commit 689cc8fbdc0613d267434f221af85aff91a31f8c

View File

@ -31,7 +31,7 @@ common haskell
, template-haskell ^>= 2.15
, text ^>= 1.2.3
, tree-sitter ^>= 0.9
, tree-sitter-java ^>= 0.7.0.0
, tree-sitter-java ^>= 0.7.0.1
ghc-options:
-Weverything
@ -63,11 +63,10 @@ test-suite test
hs-source-dirs: test
main-is: Test.hs
build-depends: base
, tree-sitter
, tree-sitter-java
, semantic-ast
, bytestring ^>= 0.10.8.2
, pathtype ^>= 0.8.1
, text
, semantic-ast
, semantic-java
, tasty
, tasty-hunit
, text

View File

@ -12,11 +12,12 @@
module Language.Java.AST
( module Language.Java.AST
, Java.getTestCorpusDir
) where
import AST.GenerateSyntax
import AST.Token
import Language.Haskell.TH.Syntax (runIO)
import qualified TreeSitter.Java as Java (getNodeTypesPath, tree_sitter_java)
import qualified TreeSitter.Java as Java (getNodeTypesPath, getTestCorpusDir, tree_sitter_java)
runIO Java.getNodeTypesPath >>= astDeclarationsForLanguage Java.tree_sitter_java

View File

@ -1,16 +1,17 @@
{-# LANGUAGE OverloadedStrings, TypeApplications #-}
module Main (main) where
import qualified System.Path as Path
import Test.Tasty
import TreeSitter.Java
import qualified TreeSitter.Java.AST as Java
import AST.Test
import AST.Unmarshal
import qualified Language.Java.AST as Java
import Language.Java.Grammar
import qualified System.Path as Path
import Test.Tasty
main :: IO ()
main
= readCorpusFiles (Path.relDir "tree-sitter-java/vendor/tree-sitter-java/corpus")
= Path.absDir <$> Java.getTestCorpusDir
>>= readCorpusFiles'
>>= traverse (testCorpus parse)
>>= defaultMain . tests
where

@ -1 +0,0 @@
Subproject commit afc4cec799f6594390aeb0ca5e16ec89e73d488e

View File

@ -31,7 +31,7 @@ common haskell
, template-haskell ^>= 2.15
, text ^>= 1.2.3
, tree-sitter ^>= 0.9
, tree-sitter-json ^>= 0.7.0.0
, tree-sitter-json ^>= 0.7.0.1
ghc-options:
-Weverything
@ -63,13 +63,12 @@ test-suite test
hs-source-dirs: test
main-is: Test.hs
build-depends: base
, tree-sitter
, tree-sitter-json
, semantic-ast
, bytestring ^>= 0.10.8.2
, hedgehog >= 0.6 && <2
, pathtype ^>= 0.8.1
, text
, semantic-ast
, semantic-json
, tasty
, tasty-hedgehog
, tasty-hunit
, text

View File

@ -11,11 +11,12 @@
{-# LANGUAGE TypeApplications #-}
module Language.JSON.AST
( module Language.JSON.AST
, JSON.getTestCorpusDir
) where
import Prelude hiding (String)
import AST.GenerateSyntax
import Language.Haskell.TH.Syntax (runIO)
import qualified TreeSitter.JSON as JSON (getNodeTypesPath, tree_sitter_json)
import qualified TreeSitter.JSON as JSON (getNodeTypesPath, getTestCorpusDir, tree_sitter_json)
runIO JSON.getNodeTypesPath >>= astDeclarationsForLanguage JSON.tree_sitter_json

View File

@ -1,16 +1,17 @@
{-# LANGUAGE DisambiguateRecordFields, OverloadedStrings, TypeApplications #-}
module Main (main) where
import qualified System.Path as Path
import Test.Tasty
import TreeSitter.JSON
import qualified TreeSitter.JSON.AST as JSON
import AST.Test
import AST.Unmarshal
import qualified Language.JSON.AST as JSON
import Language.JSON.Grammar
import qualified System.Path as Path
import Test.Tasty
main :: IO ()
main
= readCorpusFiles (Path.relDir "tree-sitter-json/vendor/tree-sitter-json/corpus")
= Path.absDir <$> JSON.getTestCorpusDir
>>= readCorpusFiles'
>>= traverse (testCorpus parse)
>>= defaultMain . tests
where parse = parseByteString @JSON.Document @() tree_sitter_json

@ -1 +0,0 @@
Subproject commit 7b6a33f300e3e88c3017e0a9d88c77b50ea6d149

View File

@ -14,7 +14,7 @@ import Options.Applicative hiding (style)
import Text.Pretty.Simple (pPrint, pPrintNoColor)
import Data.Foldable (traverse_)
import Control.Monad ((>=>))
import Marshal.JSON (marshal)
import AST.Marshal.JSON (marshal)
import Data.ByteString.Lazy.Char8 (putStrLn)
import Data.Aeson.Encode.Pretty (encodePretty)

@ -1 +0,0 @@
Subproject commit 6bb7e04216eae8314e0b893029590247418b5998

View File

@ -8,8 +8,8 @@ import qualified Data.ByteString as B
import Gauge
import System.Exit (die)
import System.Environment (getArgs)
import Language.Python.Grammar
import qualified Language.Python.AST as Py
import Language.Python.Grammar
import AST.Unmarshal
main :: IO ()

View File

@ -34,7 +34,7 @@ common haskell
, template-haskell ^>= 2.15
, text ^>= 1.2.3
, tree-sitter ^>= 0.9
, tree-sitter-python ^>= 0.9.0.1
, tree-sitter-python ^>= 0.9.0.2
, containers
ghc-options:
-Weverything
@ -116,18 +116,17 @@ test-suite test
import: haskell
type: exitcode-stdio-1.0
hs-source-dirs: test
main-is: Test.hs
main-is: PreciseTest.hs
build-depends: base
, tree-sitter
, tree-sitter-python
, semantic-ast
, bytestring ^>= 0.10.8.2
, hedgehog >= 0.6 && <2
, pathtype ^>= 0.8.1
, text
, semantic-ast
, semantic-python
, tasty
, tasty-hedgehog
, tasty-hunit
, text
executable benchmark
import: haskell
@ -138,5 +137,4 @@ executable benchmark
base
, gauge ^>= 0.2.5
, bytestring
, tree-sitter
, tree-sitter-python
, semantic-python

View File

@ -12,11 +12,12 @@
module Language.Python.AST
( module Language.Python.AST
, Python.getTestCorpusDir
) where
import Prelude hiding (False, Float, Integer, String, True)
import AST.GenerateSyntax
import Language.Haskell.TH.Syntax (runIO)
import qualified TreeSitter.Python as Python (getNodeTypesPath, tree_sitter_python)
import qualified TreeSitter.Python as Python (getNodeTypesPath, getTestCorpusDir, tree_sitter_python)
runIO Python.getNodeTypesPath >>= astDeclarationsForLanguage Python.tree_sitter_python

View File

@ -3,14 +3,15 @@ module Main (main) where
import qualified System.Path as Path
import Test.Tasty
import TreeSitter.Python
import qualified TreeSitter.Python.AST as Py
import qualified Language.Python.AST as Py
import Language.Python.Grammar
import AST.Test
import AST.Unmarshal
main :: IO ()
main
= readCorpusFiles (Path.relDir "tree-sitter-python/vendor/tree-sitter-python/test/corpus")
= Path.absDir <$> Py.getTestCorpusDir
>>= readCorpusFiles'
>>= traverse (testCorpus parse)
>>= defaultMain . tests
where parse = parseByteString @Py.Module @() tree_sitter_python

@ -1 +0,0 @@
Subproject commit 899ac8d5d6c883b2f05362c9953e14e78aac474c

View File

@ -31,7 +31,7 @@ common haskell
, template-haskell ^>= 2.15
, text ^>= 1.2.3
, tree-sitter ^>= 0.9
, tree-sitter-ruby ^>= 0.5.0.1
, tree-sitter-ruby ^>= 0.5.0.2
ghc-options:
-Weverything
@ -63,16 +63,15 @@ test-suite test
hs-source-dirs: test
main-is: Test.hs
build-depends: base
, tree-sitter
, tree-sitter-ruby
, semantic-ast
, bytestring ^>= 0.10.8.2
, hedgehog >= 0.6 && <2
, pathtype ^>= 0.8.1
, text
, semantic-ast
, semantic-ruby
, tasty
, tasty-hedgehog
, tasty-hunit
, text
executable benchmarks
import: haskell
@ -87,8 +86,7 @@ executable benchmarks
, Glob
, lens >= 4.17 && < 4.19
, pathtype ^>= 0.8.1
, tree-sitter
, tree-sitter-ruby
, semantic-ruby
executable tree-sitter-ruby
import: haskell
@ -97,5 +95,4 @@ executable tree-sitter-ruby
main-is: Main.hs
build-depends: base
, bytestring
, tree-sitter
, tree-sitter-ruby
, semantic-ruby

View File

@ -12,11 +12,12 @@
module Language.Ruby.AST
( module Language.Ruby.AST
, Ruby.getTestCorpusDir
) where
import Prelude hiding (False, Float, Integer, Rational, String, True)
import AST.GenerateSyntax
import Language.Haskell.TH.Syntax (runIO)
import qualified TreeSitter.Ruby as Ruby (getNodeTypesPath, tree_sitter_ruby)
import qualified TreeSitter.Ruby as Ruby (getNodeTypesPath, getTestCorpusDir, tree_sitter_ruby)
runIO Ruby.getNodeTypesPath >>= astDeclarationsForLanguage Ruby.tree_sitter_ruby

View File

@ -1,16 +1,17 @@
{-# LANGUAGE DisambiguateRecordFields, OverloadedStrings, TypeApplications #-}
module Main (main) where
import qualified System.Path as Path
import Test.Tasty
import TreeSitter.Ruby
import qualified TreeSitter.Ruby.AST as Rb
import AST.Test
import AST.Unmarshal
import qualified Language.Ruby.AST as Rb
import Language.Ruby.Grammar
import qualified System.Path as Path
import Test.Tasty
main :: IO ()
main
= readCorpusFiles (Path.relDir "tree-sitter-ruby/vendor/tree-sitter-ruby/test/corpus")
= Path.absDir <$> Rb.getTestCorpusDir
>>= readCorpusFiles'
>>= traverse (testCorpus parse)
>>= defaultMain . tests
where parse = parseByteString @Rb.Program @() tree_sitter_ruby

@ -1 +0,0 @@
Subproject commit eb2b6225bfb80010f2e4cbd27db8c6f3775230b5

View File

@ -31,7 +31,7 @@ common haskell
, template-haskell ^>= 2.15
, text ^>= 1.2.3
, tree-sitter ^>= 0.9
, tree-sitter-tsx ^>= 0.5.0.0
, tree-sitter-tsx ^>= 0.5.0.1
ghc-options:
-Weverything
@ -63,13 +63,12 @@ test-suite test
hs-source-dirs: test
main-is: Test.hs
build-depends: base
, tree-sitter
, tree-sitter-tsx
, semantic-ast
, bytestring ^>= 0.10.8.2
, hedgehog >= 0.6 && <2
, pathtype ^>= 0.8.1
, text
, semantic-ast
, semantic-tsx
, tasty
, tasty-hedgehog
, tasty-hunit
, text

View File

@ -12,11 +12,12 @@
module Language.TSX.AST
( module Language.TSX.AST
, TSX.getTestCorpusDir
) where
import Prelude hiding (False, Float, Integer, String, True)
import AST.GenerateSyntax
import Language.Haskell.TH.Syntax (runIO)
import qualified TreeSitter.TSX as TSX (getNodeTypesPath, tree_sitter_tsx)
import qualified TreeSitter.TSX as TSX (getNodeTypesPath, getTestCorpusDir, tree_sitter_tsx)
runIO TSX.getNodeTypesPath >>= astDeclarationsForLanguage TSX.tree_sitter_tsx

View File

@ -1,19 +1,20 @@
{-# LANGUAGE DisambiguateRecordFields, OverloadedStrings, TypeApplications #-}
module Main (main) where
import qualified System.Path as Path
import Test.Tasty
import TreeSitter.TSX
import qualified TreeSitter.TSX.AST as Ts
import AST.Test
import AST.Unmarshal
import qualified Language.TSX.AST as Tsx
import Language.TSX.Grammar
import qualified System.Path as Path
import Test.Tasty
main :: IO ()
main
= readCorpusFiles (Path.relDir "tree-sitter-tsx/vendor/tree-sitter-typescript/tsx/corpus")
= Path.absDir <$> Tsx.getTestCorpusDir
>>= readCorpusFiles'
>>= traverse (testCorpus parse)
>>= defaultMain . tests
where parse = parseByteString @Ts.Program @() tree_sitter_tsx
where parse = parseByteString @Tsx.Program @() tree_sitter_tsx
tests :: [TestTree] -> TestTree
tests = testGroup "tree-sitter-tsx corpus tests"

@ -1 +0,0 @@
Subproject commit aa950f58ea8aa112bc72f3481b98fc2d3c07b3e0

View File

@ -31,7 +31,7 @@ common haskell
, template-haskell ^>= 2.15
, text ^>= 1.2.3
, tree-sitter ^>= 0.9.0.0
, tree-sitter-typescript ^>= 0.5.0.0
, tree-sitter-typescript ^>= 0.5.0.1
ghc-options:
-Weverything
@ -63,13 +63,12 @@ test-suite test
hs-source-dirs: test
main-is: Test.hs
build-depends: base
, tree-sitter
, tree-sitter-typescript
, semantic-ast
, bytestring ^>= 0.10.8.2
, hedgehog >= 0.6 && <2
, pathtype ^>= 0.8.1
, text
, semantic-ast
, semantic-typescript
, tasty
, tasty-hedgehog
, tasty-hunit
, text

View File

@ -12,11 +12,12 @@
module Language.TypeScript.AST
( module Language.TypeScript.AST
, TypeScript.getTestCorpusDir
) where
import Prelude hiding (False, Float, Integer, String, True)
import AST.GenerateSyntax
import Language.Haskell.TH.Syntax (runIO)
import qualified TreeSitter.TypeScript as TypeScript (getNodeTypesPath, tree_sitter_typescript)
import qualified TreeSitter.TypeScript as TypeScript (getNodeTypesPath, getTestCorpusDir, tree_sitter_typescript)
runIO TypeScript.getNodeTypesPath >>= astDeclarationsForLanguage TypeScript.tree_sitter_typescript

View File

@ -1,16 +1,17 @@
{-# LANGUAGE DisambiguateRecordFields, OverloadedStrings, TypeApplications #-}
module Main (main) where
import qualified System.Path as Path
import Test.Tasty
import TreeSitter.TypeScript
import qualified TreeSitter.TypeScript.AST as Ts
import AST.Test
import AST.Unmarshal
import qualified Language.TypeScript.AST as Ts
import Language.TypeScript.Grammar
import qualified System.Path as Path
import Test.Tasty
main :: IO ()
main
= readCorpusFiles (Path.relDir "tree-sitter-typescript/vendor/tree-sitter-typescript/typescript/corpus")
= Path.absDir <$> Ts.getTestCorpusDir
>>= readCorpusFiles'
>>= traverse (testCorpus parse)
>>= defaultMain . tests
where parse = parseByteString @Ts.Program @() tree_sitter_typescript

@ -1 +0,0 @@
Subproject commit 40320d8e0953db5e173e6dfbb596d375a085ca65