From deca218163838f88ade8f62eca60d8d67db00f0d Mon Sep 17 00:00:00 2001 From: Raimo Niskanen Date: Wed, 7 Dec 2011 17:33:11 +0100 Subject: driver_SUITE.erl: Fix sys info drivers --- erts/emulator/test/driver_SUITE.erl | 24 +++---- erts/emulator/test/driver_SUITE_data/Makefile.src | 4 +- .../test/driver_SUITE_data/sys_info_1_0_drv.c | 72 ------------------- .../test/driver_SUITE_data/sys_info_1_1_drv.c | 80 ---------------------- .../test/driver_SUITE_data/sys_info_base_drv.c | 78 +++++++++++++++++++++ .../test/driver_SUITE_data/sys_info_prev_drv.c | 78 +++++++++++++++++++++ 6 files changed, 170 insertions(+), 166 deletions(-) delete mode 100644 erts/emulator/test/driver_SUITE_data/sys_info_1_0_drv.c delete mode 100644 erts/emulator/test/driver_SUITE_data/sys_info_1_1_drv.c create mode 100644 erts/emulator/test/driver_SUITE_data/sys_info_base_drv.c create mode 100644 erts/emulator/test/driver_SUITE_data/sys_info_prev_drv.c (limited to 'erts/emulator/test') diff --git a/erts/emulator/test/driver_SUITE.erl b/erts/emulator/test/driver_SUITE.erl index e159c37d2c..e7ee04f40e 100644 --- a/erts/emulator/test/driver_SUITE.erl +++ b/erts/emulator/test/driver_SUITE.erl @@ -47,8 +47,8 @@ fd_change/1, steal_control/1, otp_6602/1, - 'driver_system_info_ver1.0'/1, - 'driver_system_info_ver1.1'/1, + driver_system_info_base_ver/1, + driver_system_info_prev_ver/1, driver_system_info_current_ver/1, driver_monitor/1, @@ -135,8 +135,8 @@ all() -> [outputv_errors, outputv_echo, queue_echo, {group, timer}, driver_unloaded, io_ready_exit, use_fallback_pollset, bad_fd_in_pollset, driver_event, fd_change, - steal_control, otp_6602, 'driver_system_info_ver1.0', - 'driver_system_info_ver1.1', + steal_control, otp_6602, driver_system_info_base_ver, + driver_system_info_prev_ver, driver_system_info_current_ver, driver_monitor, {group, ioq_exit}, zero_extended_marker_garb_drv, invalid_extended_marker_drv, larger_major_vsn_drv, @@ -1083,19 +1083,19 @@ otp_6602(Config) when is_list(Config) -> -define(EXPECTED_SYSTEM_INFO_NAMES, ?EXPECTED_SYSTEM_INFO_NAMES2). -'driver_system_info_ver1.0'(doc) -> +'driver_system_info_base_ver'(doc) -> []; -'driver_system_info_ver1.0'(suite) -> +'driver_system_info_base_ver'(suite) -> []; -'driver_system_info_ver1.0'(Config) when is_list(Config) -> - ?line driver_system_info_test(Config, sys_info_1_0_drv). +'driver_system_info_base_ver'(Config) when is_list(Config) -> + ?line driver_system_info_test(Config, sys_info_base_drv). -'driver_system_info_ver1.1'(doc) -> +'driver_system_info_prev_ver'(doc) -> []; -'driver_system_info_ver1.1'(suite) -> +'driver_system_info_prev_ver'(suite) -> []; -'driver_system_info_ver1.1'(Config) when is_list(Config) -> - ?line driver_system_info_test(Config, sys_info_1_1_drv). +'driver_system_info_prev_ver'(Config) when is_list(Config) -> + ?line driver_system_info_test(Config, sys_info_prev_drv). driver_system_info_current_ver(doc) -> []; diff --git a/erts/emulator/test/driver_SUITE_data/Makefile.src b/erts/emulator/test/driver_SUITE_data/Makefile.src index dd48f6a0f7..9cc107cc66 100644 --- a/erts/emulator/test/driver_SUITE_data/Makefile.src +++ b/erts/emulator/test/driver_SUITE_data/Makefile.src @@ -16,8 +16,8 @@ MISC_DRVS = outputv_drv@dll@ \ thr_free_drv@dll@ \ async_blast_drv@dll@ -SYS_INFO_DRVS = sys_info_1_0_drv@dll@ \ - sys_info_1_1_drv@dll@ \ +SYS_INFO_DRVS = sys_info_base_drv@dll@ \ + sys_info_prev_drv@dll@ \ sys_info_curr_drv@dll@ VSN_MISMATCH_DRVS = zero_extended_marker_garb_drv@dll@ \ diff --git a/erts/emulator/test/driver_SUITE_data/sys_info_1_0_drv.c b/erts/emulator/test/driver_SUITE_data/sys_info_1_0_drv.c deleted file mode 100644 index 0504778086..0000000000 --- a/erts/emulator/test/driver_SUITE_data/sys_info_1_0_drv.c +++ /dev/null @@ -1,72 +0,0 @@ -/* ``The contents of this file are subject to the Erlang Public License, - * Version 1.1, (the "License"); you may not use this file except in - * compliance with the License. You should have received a copy of the - * Erlang Public License along with this software. If not, it can be - * retrieved via the world wide web at http://www.erlang.org/. - * - * Software distributed under the License is distributed on an "AS IS" - * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - * the License for the specific language governing rights and limitations - * under the License. - * - * The Initial Developer of the Original Code is Ericsson Utvecklings AB. - * Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings - * AB. All Rights Reserved.'' - * - * $Id$ - */ - -/* - * Author: Rickard Green - * - * Description: Driver that fakes driver version 1.0 and tests - * driver_system_info(). - * - */ - -#include "sys_info_drv_impl.h" - -#define SYS_INFO_DRV_MAJOR_VSN 1 -#define SYS_INFO_DRV_MINOR_VSN 0 -#define SYS_INFO_DRV_NAME_STR "sys_info_1_0_drv" -#define SYS_INFO_DRV_NAME sys_info_1_0_drv -#define SYS_INFO_DRV_LAST_FIELD smp_support - -#define SYS_INFO_DRV_RES_FORMAT "ok: " \ - "drv_drv_vsn=%d.%d " \ - "emu_drv_vsn=%d.%d " \ - "erts_vsn=%s " \ - "otp_vsn=%s " \ - "thread=%s " \ - "smp=%s" - - -static size_t -sys_info_drv_max_res_len(ErlDrvSysInfo *sip) -{ - size_t slen = strlen(SYS_INFO_DRV_RES_FORMAT) + 1; - slen += 2*20; /* drv_drv_vsn */ - slen += 2*20; /* emu_drv_vsn */ - slen += strlen(sip->erts_version) + 1; - slen += strlen(sip->otp_release) + 1; - slen += 5; /* threads */ - slen += 5; /* smp */ - return slen; -} - -static size_t -sys_info_drv_sprintf_sys_info(ErlDrvSysInfo *sip, char *str) -{ - return sprintf(str, - SYS_INFO_DRV_RES_FORMAT, - SYS_INFO_DRV_MAJOR_VSN, - SYS_INFO_DRV_MINOR_VSN, - sip->driver_major_version, - sip->driver_minor_version, - sip->erts_version, - sip->otp_release, - sip->thread_support ? "true" : "false", - sip->smp_support ? "true" : "false"); -} - -#include "sys_info_drv_impl.c" diff --git a/erts/emulator/test/driver_SUITE_data/sys_info_1_1_drv.c b/erts/emulator/test/driver_SUITE_data/sys_info_1_1_drv.c deleted file mode 100644 index fa21828284..0000000000 --- a/erts/emulator/test/driver_SUITE_data/sys_info_1_1_drv.c +++ /dev/null @@ -1,80 +0,0 @@ -/* ``The contents of this file are subject to the Erlang Public License, - * Version 1.1, (the "License"); you may not use this file except in - * compliance with the License. You should have received a copy of the - * Erlang Public License along with this software. If not, it can be - * retrieved via the world wide web at http://www.erlang.org/. - * - * Software distributed under the License is distributed on an "AS IS" - * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - * the License for the specific language governing rights and limitations - * under the License. - * - * The Initial Developer of the Original Code is Ericsson Utvecklings AB. - * Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings - * AB. All Rights Reserved.'' - * - * $Id$ - */ - -/* - * Author: Rickard Green - * - * Description: Driver that fakes driver version 1.1 and tests - * driver_system_info(). - * - */ - -#include "sys_info_drv_impl.h" - -#define SYS_INFO_DRV_MAJOR_VSN 1 -#define SYS_INFO_DRV_MINOR_VSN 1 -#define SYS_INFO_DRV_NAME_STR "sys_info_1_1_drv" -#define SYS_INFO_DRV_NAME sys_info_1_1_drv -#define SYS_INFO_DRV_LAST_FIELD scheduler_threads - -#define SYS_INFO_DRV_RES_FORMAT "ok: " \ - "drv_drv_vsn=%d.%d " \ - "emu_drv_vsn=%d.%d " \ - "erts_vsn=%s " \ - "otp_vsn=%s " \ - "thread=%s " \ - "smp=%s " \ - "async_thrs=%d " \ - "sched_thrs=%d" - - -static size_t -sys_info_drv_max_res_len(ErlDrvSysInfo *sip) -{ - size_t slen = strlen(SYS_INFO_DRV_RES_FORMAT) + 1; - slen += 2*20; /* drv_drv_vsn */ - slen += 2*20; /* emu_drv_vsn */ - slen += strlen(sip->erts_version) + 1; - slen += strlen(sip->otp_release) + 1; - slen += 5; /* threads */ - slen += 5; /* smp */ - slen += 20; /* async_thrs */ - slen += 20; /* sched_thrs */ - return slen; -} - -static size_t -sys_info_drv_sprintf_sys_info(ErlDrvSysInfo *sip, char *str) -{ - return sprintf(str, - SYS_INFO_DRV_RES_FORMAT, - SYS_INFO_DRV_MAJOR_VSN, - SYS_INFO_DRV_MINOR_VSN, - sip->driver_major_version, - sip->driver_minor_version, - sip->erts_version, - sip->otp_release, - sip->thread_support ? "true" : "false", - sip->smp_support ? "true" : "false", - sip->async_threads, - sip->scheduler_threads); -} - -#include "sys_info_drv_impl.c" - - diff --git a/erts/emulator/test/driver_SUITE_data/sys_info_base_drv.c b/erts/emulator/test/driver_SUITE_data/sys_info_base_drv.c new file mode 100644 index 0000000000..c22a415c59 --- /dev/null +++ b/erts/emulator/test/driver_SUITE_data/sys_info_base_drv.c @@ -0,0 +1,78 @@ +/* ``The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved via the world wide web at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * + * The Initial Developer of the Original Code is Ericsson Utvecklings AB. + * Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings + * AB. All Rights Reserved.'' + * + * $Id$ + */ + +/* + * Author: Rickard Green + * + * Description: Driver that fakes driver version 2.0 and tests + * driver_system_info(). + * + */ + +#include "sys_info_drv_impl.h" + +#define SYS_INFO_DRV_MAJOR_VSN 2 +#define SYS_INFO_DRV_MINOR_VSN 0 +#define SYS_INFO_DRV_NAME_STR "sys_info_base_drv" +#define SYS_INFO_DRV_NAME sys_info_base_drv +#define SYS_INFO_DRV_LAST_FIELD smp_support +#define ERL_DRV_SYS_INFO_SIZE sizeof(ErlDrvSysInfo) + +#define SYS_INFO_DRV_RES_FORMAT "ok: " \ + "drv_drv_vsn=%d.%d " \ + "emu_drv_vsn=%d.%d " \ + "erts_vsn=%s " \ + "otp_vsn=%s " \ + "thread=%s " \ + "smp=%s " \ + "async_thrs=%d " \ + "sched_thrs=%d" + +static size_t +sys_info_drv_max_res_len(ErlDrvSysInfo *sip) +{ + size_t slen = strlen(SYS_INFO_DRV_RES_FORMAT) + 1; + slen += 2*20; /* drv_drv_vsn */ + slen += 2*20; /* emu_drv_vsn */ + slen += strlen(sip->erts_version) + 1; + slen += strlen(sip->otp_release) + 1; + slen += 5; /* threads */ + slen += 5; /* smp */ + slen += 20; /* async_thrs */ + slen += 20; /* sched_thrs */ + return slen; +} + +static size_t +sys_info_drv_sprintf_sys_info(ErlDrvSysInfo *sip, char *str) +{ + return sprintf(str, + SYS_INFO_DRV_RES_FORMAT, + SYS_INFO_DRV_MAJOR_VSN, + SYS_INFO_DRV_MINOR_VSN, + sip->driver_major_version, + sip->driver_minor_version, + sip->erts_version, + sip->otp_release, + sip->thread_support ? "true" : "false", + sip->smp_support ? "true" : "false", + sip->async_threads, + sip->scheduler_threads); +} + +#include "sys_info_drv_impl.c" diff --git a/erts/emulator/test/driver_SUITE_data/sys_info_prev_drv.c b/erts/emulator/test/driver_SUITE_data/sys_info_prev_drv.c new file mode 100644 index 0000000000..815d96cc97 --- /dev/null +++ b/erts/emulator/test/driver_SUITE_data/sys_info_prev_drv.c @@ -0,0 +1,78 @@ +/* ``The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved via the world wide web at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * + * The Initial Developer of the Original Code is Ericsson Utvecklings AB. + * Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings + * AB. All Rights Reserved.'' + * + * $Id$ + */ + +/* + * Author: Rickard Green + * + * Description: Driver that fakes driver version 2.0 and tests + * driver_system_info(). + * + */ + +#include "sys_info_drv_impl.h" + +#define SYS_INFO_DRV_MAJOR_VSN 2 +#define SYS_INFO_DRV_MINOR_VSN 0 +#define SYS_INFO_DRV_NAME_STR "sys_info_prev_drv" +#define SYS_INFO_DRV_NAME sys_info_prev_drv +#define SYS_INFO_DRV_LAST_FIELD scheduler_threads +#define ERL_DRV_SYS_INFO_SIZE sizeof(ErlDrvSysInfo) + +#define SYS_INFO_DRV_RES_FORMAT "ok: " \ + "drv_drv_vsn=%d.%d " \ + "emu_drv_vsn=%d.%d " \ + "erts_vsn=%s " \ + "otp_vsn=%s " \ + "thread=%s " \ + "smp=%s " \ + "async_thrs=%d " \ + "sched_thrs=%d" + +static size_t +sys_info_drv_max_res_len(ErlDrvSysInfo *sip) +{ + size_t slen = strlen(SYS_INFO_DRV_RES_FORMAT) + 1; + slen += 2*20; /* drv_drv_vsn */ + slen += 2*20; /* emu_drv_vsn */ + slen += strlen(sip->erts_version) + 1; + slen += strlen(sip->otp_release) + 1; + slen += 5; /* threads */ + slen += 5; /* smp */ + slen += 20; /* async_thrs */ + slen += 20; /* sched_thrs */ + return slen; +} + +static size_t +sys_info_drv_sprintf_sys_info(ErlDrvSysInfo *sip, char *str) +{ + return sprintf(str, + SYS_INFO_DRV_RES_FORMAT, + SYS_INFO_DRV_MAJOR_VSN, + SYS_INFO_DRV_MINOR_VSN, + sip->driver_major_version, + sip->driver_minor_version, + sip->erts_version, + sip->otp_release, + sip->thread_support ? "true" : "false", + sip->smp_support ? "true" : "false", + sip->async_threads, + sip->scheduler_threads); +} + +#include "sys_info_drv_impl.c" -- cgit v1.2.3