Verified Commit d5f1efa3 authored by Camil Staps's avatar Camil Staps 🚀

Drop Cloogle dependency; resolves #6

parent 57d19298
Pipeline #12890 failed with stage
in 43 seconds
Clean System Files/
clean-compiler/
*.abc
*.o
*.prj
testproperties
[submodule "Cloogle"]
path = Cloogle
url = https://github.com/clean-cloogle/Cloogle
Subproject commit d4176dc144f87d5c9581e2cf1fd155fd1a066aa2
SHELL:=/bin/bash
BIN:=testproperties
CLM:=clm
CLMFLAGS:=-nr -nt -h 100m -nortsopts\
-IL ArgEnv\
-IL Platform\
-I Cloogle\
-I Cloogle/libcloogle\
-I Cloogle/CleanPrettyPrint\
-I Cloogle/CleanRegex\
-I Cloogle/CleanTypes\
-I Cloogle/clean-compiler/frontend\
-I Cloogle/clean-compiler/backend\
-I Cloogle/clean-compiler/main\
-I Cloogle/clean-compiler/main/Unix
.PHONY: all clean
all: $(BIN)
$(BIN): Cloogle/clean-compiler .FORCE
$(CLM) $(CLMFLAGS) $@ -o $@
$(BIN): %: %.prj clean-compiler .FORCE
cpm $<
Cloogle/clean-compiler:
$(MAKE) -C Cloogle clean-compiler
$(addsuffix .prj,$(BIN)): %.prj: %.prj.default
cp $^ $@
clean-compiler:
svn checkout -r 3022 https://svn.cs.ru.nl/repos/clean-compiler/branches/itask/ clean-compiler
$(MAKE) -j -C clean-compiler/main/Unix
$(MAKE) -j -C clean-compiler/backendC/CleanCompilerSources -f Makefile.linux64
ln -s ../../backendC/CleanCompilerSources/backend.a clean-compiler/backend/Clean\ System\ Files/backend_library
clean:
$(RM) -r **/Clean\ System\ Files $(BIN)
shopt -s globstar; $(RM) -r **/Clean\ System\ Files $(BIN) $(addsuffix .prj,$(BIN))
.FORCE:
......@@ -5,6 +5,7 @@ import StdBool
import StdEnum
import StdFile
from StdFunc import o
import StdMisc
import StdOrdList
import StdString
import StdTuple
......@@ -27,8 +28,22 @@ import Text
import Text.Language
import Clean.Doc
import Clean.Types.Util
import Cloogle.DB.Factory
import Clean.Parse
import Clean.Parse.Comments
import Clean.Types.Util => qualified :: Priority
from syntax import
:: FunKind,
:: FunSpecials,
:: Ident{id_name},
:: Module{mod_defs,mod_ident},
:: Optional,
:: ParsedDefinition(PD_Function,PD_TypeSpec),
:: ParsedExpr,
:: Position,
:: Priority,
:: Rhs,
:: SymbolType
:: Options =
{ directory :: !FilePath
......@@ -59,7 +74,7 @@ defaultOptions =
, print_options = []
, test_options = []
, compile = False
, clm_args = []
, clm_args = ["-nt", "-nr"]
, run = False
, verbosity = SUCCESS
, color = True
......@@ -196,15 +211,28 @@ handleModule :: !Options !FilePath !*World -> *World
handleModule opts fp w
# w = output DEBUG ("Checking " +++ fp +++ "...") opts w
// Find properties
# (funs,macros,_,_,_,_,_,_,(modname,mod,_),w) = findModuleContents False (dropExtension fp) w
#! (comments,w) = scanComments fp w
#! (dcl,w) = readModule fp w
#! (modid,dcldefs,documentation) = case dcl of
Error _ -> (abort "failed to parse module\n", [], emptyCollectedComments)
Ok (dcl,_) -> (dcl.mod_ident, dcl.mod_defs, case comments of
Error _ -> emptyCollectedComments
Ok comments -> collectComments comments dcl)
# moddoc = case parseDoc <$> getComment modid documentation of
Just (Right (doc,_)) -> Just doc
_ -> Nothing
# modname = modid.id_name
# output_modname = opts.output_prefix +++ "." +++ modname
# output_filename = opts.output_directory </> replaceSubString "." {pathSeparator} output_modname +++ ".icl"
# (nprops,coverage,props) = generatePropertyModule
output_modname modname
opts.print_options
opts.test_options
mod
[(loc,f) \\ (loc,f,_) <- funs ++ macros]
moddoc
[(id.id_name,doc) \\
id <- [id \\ PD_Function pos id _ _ _ _ <- dcldefs] ++ [id \\ PD_TypeSpec pos id _ _ _ <- dcldefs],
Just docstring <- [getComment id documentation],
Right (doc,_) <- [parseDoc docstring]]
// Write properties
| nprops == 0 = w
# w = output INFO
......@@ -249,9 +277,9 @@ where
interleave _ [] = []
interleave g [x:xs] = [g,x:interleave g xs]
generatePropertyModule :: !String !String ![String] ![String] !ModuleEntry
![(LocationInModule,FunctionEntry)] -> (!Int, !Real, !String)
generatePropertyModule testmodname modname print_options test_options me fes
generatePropertyModule :: !String !String ![String] ![String] !(Maybe ModuleDoc)
![(!String,!FunctionDoc)] -> (!Int, !Real, !String)
generatePropertyModule testmodname modname print_options test_options mod_doc fes
= (length props, coverage, tests)
where
n_props = length props
......@@ -269,13 +297,13 @@ where
]
propsets = map (uncurry $ generateProperties pvis generators) fes
where pvis = fromMaybe [] $ docPropertyTestWith <$> me.me_documentation
where pvis = fromMaybe [] $ docPropertyTestWith <$> mod_doc
props = flatten propsets
bootstrap = fromMaybe "" (docPropertyBootstrap =<< me.me_documentation)
bootstrap = fromMaybe "" (docPropertyBootstrap =<< mod_doc)
generators = [("gast_generator_" <+ i,type,imp) \\ i <- [0..]
& PropertyTestGenerator type imp <- fromMaybe [] (docPropertyTestGenerators <$> me.me_documentation)]
& PropertyTestGenerator type imp <- fromMaybe [] (docPropertyTestGenerators <$> mod_doc)]
generators_string = join "\n\n" $ map makeGenerator $ generators
where
makeGenerator :: NamedTestGenerator -> String
......@@ -299,10 +327,9 @@ where
:: NamedTestGenerator :== (String, Type, String)
generateProperties :: ![PropertyVarInstantiation] ![NamedTestGenerator]
!LocationInModule !FunctionEntry -> [GeneratedProperty]
generateProperties pvis generators loc fe=:{fe_documentation=Just doc} =
[gen i (fromJust loc.LocationInModule.name) doc.preconditions p config
generateProperties :: ![PropertyVarInstantiation] ![NamedTestGenerator] !String !FunctionDoc -> [GeneratedProperty]
generateProperties pvis generators fname doc =
[gen i fname doc.preconditions p config
\\ p <- doc.properties
, config <- configurations $ groupInstantiations $ pvis ++ docPropertyTestWith doc
& i <- [1..]]
......@@ -348,4 +375,3 @@ where
fixname :: String -> String
fixname s = {if (isAlphanum c) c '_' \\ c <-: s}
generateProperties _ _ _ _ = []
Version: 1.4
Global
ProjectRoot: .
Target: StdEnv
Exec: {Project}/testproperties
CodeGen
CheckStacks: False
CheckIndexes: True
Application
HeapSize: 104857600
StackSize: 512000
ExtraMemory: 8192
IntialHeapSize: 204800
HeapSizeMultiplier: 4096
ShowExecutionTime: False
ShowGC: False
ShowStackSize: False
MarkingCollector: False
DisableRTSFlags: True
StandardRuntimeEnv: True
Profile
Memory: False
MemoryMinimumHeapSize: 0
Time: False
Stack: False
Dynamics: False
GenericFusion: False
DescExL: False
Output
Output: NoReturnType
Font: Monaco
FontSize: 9
WriteStdErr: False
Link
LinkMethod: Static
GenerateRelocations: False
GenerateSymbolTable: False
GenerateLinkMap: False
LinkResources: False
ResourceSource:
GenerateDLL: False
ExportedNames:
Paths
Path: {Project}
Path: {Project}*clean-compiler*frontend
Path: {Project}*clean-compiler*backend
Path: {Project}*clean-compiler*main
Path: {Project}*clean-compiler*main*Unix
Path: {Application}*lib*Platform
Path: {Application}*lib*Platform*Deprecated*ArgEnv
OtherPaths
Path: {Application}*lib*StdEnv
Precompile:
Postlink:
MainModule
Name: testproperties
Dir: {Project}
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
ReadableABC: False
ReuseUniqueNodes: True
Fusion: False
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment