1/* 2 * ticket-683.sli 3 * 4 * This file is part of NEST. 5 * 6 * Copyright (C) 2004 The NEST Initiative 7 * 8 * NEST is free software: you can redistribute it and/or modify 9 * it under the terms of the GNU General Public License as published by 10 * the Free Software Foundation, either version 2 of the License, or 11 * (at your option) any later version. 12 * 13 * NEST is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with NEST. If not, see <http://www.gnu.org/licenses/>. 20 * 21 */ 22 23/** @BeginDocumentation 24 25Name: testsuite::ticket-683 - Ensure that NEST raises error when number of threads changed too late. 26 27Synopsis: (ticket-683) run -> NEST exits if test fails 28 29Description: 30Ensures that NEST throws an error if the number of threads is being changed after 1. custom neuron 31models have been created or 2. model defaults have been changed. Each test is also run with 32number of threads changed first, this should work. 33 34Author: Maximilian Schmidt, 2014-10-08 35 */ 36 37(unittest) run 38/unittest using 39 40M_ERROR setverbosity 41 42[ 43 { /iaf_psc_alpha /test_neuron CopyModel } 44 { /static_synapse /test_synapse CopyModel } 45 { /iaf_psc_alpha << /V_reset -100. >> SetDefaults } 46 { /static_synapse << /weight 10. >> SetDefaults } 47] 48{ 49 /task Set 50 [ 51 << /local_num_threads 2 >> 52 << /total_num_virtual_procs 2 >> 53 ] 54 { 55 /kstatdict Set 56 57 % copying/setting defaults before setting threads 58 % this should fail 59 { 60 ResetKernel 61 task % this executes the task 62 kstatdict SetKernelStatus 63 } fail_or_die 64 65 % copying/setting defaults after setting threads 66 % this should pass 67 { 68 ResetKernel 69 kstatdict SetKernelStatus 70 task % this executes the task 71 } pass_or_die 72 73 } 74 forall 75} 76forall 77 78