Examples of MessageLogger


Examples of org.openquark.cal.compiler.MessageLogger

       
        String expectedValue = "Thread " + threadID + " iteration " + iterID;

        try {
            String functionName = "tempFunc" + threadID + "_" + iterID;
            CompilerMessageLogger logger = new MessageLogger();
           
            EntryPoint entryPoint = workspaceManager.getCompiler().getEntryPoint(
                new AdjunctSource.FromSourceModel(
                    SourceModel.FunctionDefn.Algebraic.make(
                        functionName, Scope.PRIVATE, null,
View Full Code Here

Examples of org.openquark.cal.compiler.MessageLogger

    private static void help_compileEvalDependentTestFunctionForThread(WorkspaceManager workspaceManager, ModuleName targetModule, String definingExpr, Object expectedValue, int threadID, int iterID, int numEvalTries, List asserts) {
       
        try {
            String functionName = "tempFunc" + threadID + "_" + iterID;
           
            CompilerMessageLogger logger = new MessageLogger();
           
            EntryPoint entryPoint = workspaceManager.getCompiler().getEntryPoint(
                new AdjunctSource.FromSourceModel(
                    SourceModel.FunctionDefn.Algebraic.make(
                        functionName, Scope.PRIVATE, null,
View Full Code Here

Examples of org.openquark.cal.compiler.MessageLogger

        for (int i = 0; i < numThreads; i++) {
            final int threadID = i;
            threads[i] = new Thread() {
                public void run() {
                    ModuleName moduleName = ModuleName.make("TempModule" + threadID);
                    MessageLogger messageLogger = new MessageLogger();
                    workspaceManager.makeModule(new SourceModelModuleSource(SourceModelUtilities.TextParsing.parseModuleDefnIntoSourceModel("module " + moduleName + "; import " + CAL_Prelude.MODULE_NAME + "; public foo x = (\\y -> x + x + y) 3.0; public bar = foo;")), messageLogger);
                   
                    if (messageLogger.getNErrors() > 0) {
                        multithreadedAssertEquals("No compilation errors", messageLogger.toString(), assertList);
                    } else {
                        for (int k = 0; k < numDependentModules; k++) {
                            String moduleName2 = "TempModule" + threadID + "_" + k;
                            workspaceManager.makeModule(new SourceModelModuleSource(SourceModelUtilities.TextParsing.parseModuleDefnIntoSourceModel("module " + moduleName2 + "; import " + CAL_Prelude.MODULE_NAME + "; import " + moduleName + ";")), messageLogger);
                        }
                        if (messageLogger.getNErrors() > 0) {
                            multithreadedAssertEquals("No compilation errors", messageLogger.toString(), assertList);
                        } else {
                            for (int j = 0; j < numCompilationsPerThread; j++) {
                                help_compileEvalTestFunctionForThread(workspaceManager, moduleName, threadID, j, numEvalTries, assertList);
                               
                                for (int k = 0; k < numDependentModules; k++) {
View Full Code Here

Examples of org.openquark.cal.compiler.MessageLogger

            final int threadID = i;
            threads[i] = new Thread() {
                public void run() {
                    String moduleName = "TempMultithreadedModule" + threadID;
                    for (int j = 0; j < numCompilationsPerThread; j++) {
                        MessageLogger messageLogger = new MessageLogger();
                        try {
                            workspaceManager.makeModule(new SourceModelModuleSource(SourceModelUtilities.TextParsing.parseModuleDefnIntoSourceModel("module " + moduleName + "; import Prelude; public foo x = (\\y -> x + x + y) 3.0; public bar = foo;")), messageLogger);
                        } catch (Exception e) {
                            StringWriter sw = new StringWriter();
                            PrintWriter pw = new PrintWriter(sw);
View Full Code Here

Examples of org.openquark.cal.compiler.MessageLogger

                machineType, workspaceFileProperty, defaultWorkspaceFile,
                defaultWorkspaceClientID);

            conditionallyCleanupRuntime(calServices, null);
           
            MessageLogger logger = new MessageLogger();
           
            calServices.compileWorkspace(null, logger);

            commonCALServices.put(key, calServices);
           
            if (SHOW_INSTANCE_CREATION) {
                System.out.println("New common CAL services - " + key);
                try {
                    throw new Exception();
                } catch (Exception e) {
                    StackTraceElement[] stackTrace = e.getStackTrace();
                    for (final StackTraceElement element : stackTrace) {
                        System.out.println("   at " + element);
                    }
                }
            }

            if (logger.getNErrors() > 0) {
                Assert.fail("Compilation of workspace failed: " + logger.getCompilerMessages());
            }
            return calServices;
        }
    }
View Full Code Here

Examples of org.openquark.cal.compiler.MessageLogger

            defaultWorkspaceClientID, sourceGenerationRootSuffix);
       
        conditionallyCleanupRuntime(calServices, sourceGenerationRootSuffix);
       
        if (shouldCompile) {
            MessageLogger logger = new MessageLogger();

            calServices.compileWorkspace(null, logger);

            if (logger.getNErrors() > 0) {
                Assert.fail("Compilation of workspace failed: " + logger.getCompilerMessages());
            }
        }
        return calServices;
    }
View Full Code Here

Examples of org.openquark.cal.compiler.MessageLogger

    public static void testWorkspaceValidity(String workspaceName) {
       
        BasicCALServices privateCopyLeccServices =
            CALServicesTestUtilities.makeUnsharedUnitTestCALServices(workspaceName, false);
       
        MessageLogger logger = new MessageLogger();
        privateCopyLeccServices.compileWorkspace(null, logger);
       
        if (logger.getNErrors() > 0) {
            String message = "Compilation of the workspace failed with these errors:\n" + logger.toString();
           
            if (SHOW_DEBUGGING_OUTPUT) {
                System.err.println(message);
            }
           
View Full Code Here

Examples of org.openquark.cal.compiler.MessageLogger

        AdjunctSource source = new AdjunctSource.FromSourceModel(
                SourceModel.FunctionDefn.Algebraic.make(adjunctUnqualifiedName, Scope.PUBLIC, null, funcExpr));
       

        WorkspaceManager workspaceManager = leccCALServices.getWorkspaceManager();
        CompilerMessageLogger logger = new MessageLogger();
       
       
        // Compile the adjunct definition.       
        EntryPointSpec entryPointSpec = EntryPointSpec.make(qualifiedAdjunctName, new InputPolicy[0], OutputPolicy.DEFAULT_OUTPUT_POLICY);
        workspaceManager.getCompiler().getEntryPoint (source, entryPointSpec, adjunctModuleName,  logger);

        if (logger.getMaxSeverity().compareTo(CompilerMessage.Severity.ERROR) >= 0) {
            fail("Compilation failed: " + logger.getFirstError().getMessage());
        }
       

        // Get the classloader for module with the adjunct we compiled.
        LECCModule module = (LECCModule)workspaceManager.getModuleTypeInfo(adjunctModuleName).getModule();
View Full Code Here

Examples of org.openquark.cal.compiler.MessageLogger

       
        // Init the workspace.
        workspaceManager.initWorkspace(workspaceDeclarationProvider, true, compileStatus);
        assertEquals(compileStatus.getSeverity(), Status.Severity.OK);
       
        MessageLogger logger = new MessageLogger();
        workspaceManager.compile(logger, false, null);
       
        if (logger.getMaxSeverity().compareTo(CompilerMessage.Severity.WARNING) > 0) {
            fail("Compilation failed:\n" + logger.toString());
        }
       
        return new Pair<WorkspaceManager, File>(workspaceManager, rootDir);
    }
View Full Code Here

Examples of org.openquark.cal.compiler.MessageLogger

     * @param functionName
     * @throws CALExecutorException
     */
    static void help_testWithFunction(WorkspaceManager workspaceManager, ModuleName moduleName, String functionName) throws CALExecutorException {

        CompilerMessageLogger logger = new MessageLogger();
        EntryPoint entryPoint = workspaceManager.getCompiler().getEntryPoint(
            EntryPointSpec.make(QualifiedName.make(moduleName, functionName)),
            moduleName,
            logger);
       
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.