Changeset 13482


Ignore:
Timestamp:
Sep 15, 2019 7:13:49 PM (3 months ago)
Author:
Christian Andersson
Message:

Added a test for unknown shared library. Related to ticket:5837

Location:
branches/dev-cw-evaluator/Python/src/tests_jmodelica
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/dev-cw-evaluator/Python/src/tests_jmodelica/files/Modelica/ExtFunctionTests.mo

    r13481 r13482  
    5656 Real c = add(a,b,a,b,a,b,a,b,a);
    5757end Evaluator_Multiple_Add;
     58
     59model Evaluator_Unknown_Shared
     60    function unknown_function
     61        input Real a;
     62        output Real b;
     63        external "C" b = unknown(a) annotation(Library="unknown");
     64    end unknown_function;
     65   
     66    constant Real a = unknown_function(1.0);
     67end Evaluator_Unknown_Shared;
    5868
    5969model ExtFunctionTest1
  • branches/dev-cw-evaluator/Python/src/tests_jmodelica/general/test_extfunctions.py

    r13481 r13482  
    9090        assert matches == 1, "Does not seem to disabling the evaluator"
    9191
     92    @testattr(stddist_base = True)
     93    def test_unknown_shared_library(self):
     94        cpath = "ExtFunctionTests.Evaluator_Unknown_Shared"
     95        try:
     96            fmu_name = compile_fmu(cpath, self.fpath, compiler_options={"enable_external_evaluator":True}, compiler_log_level="d:log_unknown_shared.txt")
     97        except: #The compilation will fail, the interesting parts will though still be contained in the log file
     98            pass
     99       
     100        matches = 0
     101        with open("log_unknown_shared.txt") as f:
     102            res = fnmatch.filter(f, "Could not find a shared library containing*")
     103            matches = len(res)
     104       
     105        assert matches == 1, "Seems to have found an unknown shared library"
    92106   
    93107class TestExternalStatic:
Note: See TracChangeset for help on using the changeset viewer.