コード例 #1
0
def test_grab_additionl_env():
    manager = initIOCs.IOCActionManager('./testiocs', './test_bundle_standard',
                                        False, False, False, True)
    action = initIOCs.IOCAction('ADSimDetector', 'test-sim1', '', 'sim1:', '',
                                '4040', '', '')
    st_base_path = 'tests/test_bundle_standard/support/areaDetector/ADSimDetector/iocs/simDetectorIOC/iocBoot/iocSimDetector/Makefile'
    manager.grab_additional_env(action, st_base_path)
    assert action.epics_environment['MAX_THREADS'] == '8'
    assert action.epics_environment['EPICS_DB_INCLUDE_PATH'] == '$(ADCORE)/db'
コード例 #2
0
def test_find_files_flat():
    pwd = os.getcwd()
    sim_exe = 'tests/test_bundle_flat/areaDetector/ADSimDetector/iocs/simDetectorIOC/bin/linux-x86_64/simDetectorApp'
    sim_dbd = 'iocs/simDetectorIOC/dbd/simDetectorApp.dbd'
    sim_iocBoot = 'tests/test_bundle_flat/areaDetector/ADSimDetector/iocs/simDetectorIOC/iocBoot/iocSimDetector'
    # We only care about the IOC type here.
    action = initIOCs.IOCAction('ADSimDetector', '', '', '', '', '', '')
    det_exe, det_dbd, det_iocBoot = manager_flat.find_paths_for_action(action)
    assert sim_exe == det_exe
    assert sim_dbd == det_dbd
    assert sim_iocBoot == det_iocBoot
コード例 #3
0
def test_get_lib_path_str():
    if platform == 'win32':
        pass
    else:
        os.chdir('tests')
        manager = initIOCs.IOCActionManager('./testiocs',
                                            './test_bundle_standard', False,
                                            False, False, True)
        action = initIOCs.IOCAction('ADSimDetector', '', '', 'sim1:', '', '',
                                    '', '')
        lib_path = manager.get_lib_path_str(action)
        print(lib_path)
        assert lib_path == 'export LD_LIBRARY_PATH=./test_bundle_standard/base/bin/linux-x86_64:./test_bundle_standard/base/lib/linux-x86_64:./test_bundle_standard/support/testModule/bin/linux-x86_64:./test_bundle_standard/support/testModule/lib/linux-x86_64:./test_bundle_standard/support/areaDetector/ADSupport/bin/linux-x86_64:./test_bundle_standard/support/areaDetector/ADSupport/lib/linux-x86_64:./test_bundle_standard/support/areaDetector/ADCore/bin/linux-x86_64:./test_bundle_standard/support/areaDetector/ADCore/lib/linux-x86_64:./test_bundle_standard/support/areaDetector/ADSimDetector/bin/linux-x86_64:./test_bundle_standard/support/areaDetector/ADSimDetector/lib/linux-x86_64:$LD_LIBRARY_PATH'
        os.chdir('..')
コード例 #4
0
def test_generate_env_paths():
    os.chdir('tests')
    pwd = os.getcwd()
    manager = initIOCs.IOCActionManager('./testiocs', './test_bundle_standard',
                                        False, False, False, True)
    action = initIOCs.IOCAction('ADSimDetector', 'test-sim1', '', 'sim1:', '',
                                '4040', '', '')
    manager.initialize_ioc_directory()
    os.mkdir('testiocs/test-sim1')
    manager.generate_env_paths(action)
    fp1 = open('testiocs/test-sim1/envPaths', 'r')
    fp2 = open('expected_files/expected_envPaths', 'r')
    assert HELPER.compare_files(fp1, fp2)
    fp1.close()
    fp2.close()
    shutil.rmtree('testiocs')
    os.chdir('..')
コード例 #5
0
def test_create_config_file():
    os.chdir('tests')
    manager = initIOCs.IOCActionManager('./testiocs', './test_bundle_standard',
                                        False, False, False, True)
    action = initIOCs.IOCAction('ADSimDetector', 'test-sim1', '', 'sim1:', '',
                                '4040', '', '')
    action.epics_environment['HOSTNAME'] = 'localhost'
    manager.initialize_ioc_directory()
    os.mkdir('testiocs/test-sim1')
    manager.create_config_file(action)
    fp1 = open('testiocs/test-sim1/config', 'r')
    fp2 = open('expected_files/expected_config', 'r')
    assert HELPER.compare_files(fp1, fp2)
    fp1.close()
    fp2.close()
    shutil.rmtree('testiocs')
    os.chdir('..')
コード例 #6
0
def test_generate_st_cmd():
    os.chdir('tests')
    pwd = os.getcwd()
    manager = initIOCs.IOCActionManager('./testiocs', './test_bundle_standard',
                                        False, False, False, True)
    action = initIOCs.IOCAction('ADSimDetector', 'test-sim1', 'TEST1:',
                                'sim1:', 'TS1', '4040', 'NA', 3)
    action.epics_environment['HOSTNAME'] = 'localhost'
    action.epics_environment['EPICS_CA_ADDR_LIST'] = '127.0.0.255'
    action.epics_environment['ENGINEER'] = 'J. Wlodek'
    manager.initialize_ioc_directory()
    os.mkdir('testiocs/test-sim1')
    st_base_path = 'test_bundle_standard/support/areaDetector/ADSimDetector/iocs/simDetectorIOC/iocBoot/iocSimDetector/st_base.cmd'
    manager.grab_additional_env(action, st_base_path)
    exe_path, dbd_path, iocBoot_path = manager.find_paths_for_action(action)
    manager.genertate_st_cmd(action, exe_path, st_base_path, dbd_path=dbd_path)
    fp1 = open('testiocs/test-sim1/st.cmd', 'r')
    fp2 = open('expected_files/expected_st.cmd', 'r')
    assert HELPER.compare_files(fp1, fp2)
    fp1.close()
    fp2.close()
    shutil.rmtree('testiocs')
    os.chdir('..')
コード例 #7
0
def test_add_to_environment():
    action = initIOCs.IOCAction('ADSimDetector', '', '', '', '', '', '')
    action.add_to_environment('epicsEnvSet("TEST_ENV_SET", "TEST_VALUE")')
    assert 'TEST_ENV_SET' in action.epics_environment.keys()
    assert action.epics_environment['TEST_ENV_SET'] == 'TEST_VALUE'