2018-07-18 Fred Gleason <fredg@paravelsystems.com>

* Removed 'sas_switch_torture' and 'sas_torture' from 'tests/'.
This commit is contained in:
Fred Gleason 2018-07-18 21:15:33 +00:00
parent f7bae36307
commit e7d48a3f99
6 changed files with 2 additions and 519 deletions

View File

@ -17164,3 +17164,5 @@
2018-07-18 Fred Gleason <fredg@paravelsystems.com>
* Cleaned up SQL quieries in 'ripcd/' to ensure UTF-8
compatibility.
2018-07-18 Fred Gleason <fredg@paravelsystems.com>
* Removed 'sas_switch_torture' and 'sas_torture' from 'tests/'.

View File

@ -37,8 +37,6 @@ noinst_PROGRAMS = audio_convert_test\
mcast_recv_test\
rdxml_parse_test\
reserve_carts_test\
sas_switch_torture\
sas_torture\
stringcode_test\
test_hash\
test_pam\
@ -75,14 +73,6 @@ rdxml_parse_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@
dist_reserve_carts_test_SOURCES = reserve_carts_test.cpp reserve_carts_test.h
reserve_carts_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@
dist_sas_switch_torture_SOURCES = sas_switch_torture.cpp sas_switch_torture.h
nodist_sas_switch_torture_SOURCES = moc_sas_switch_torture.cpp
sas_switch_torture_LDADD = @LIB_RDLIBS@ @LIBVORBIS@
dist_sas_torture_SOURCES = sas_torture.cpp sas_torture.h
nodist_sas_torture_SOURCES = moc_sas_torture.cpp
sas_torture_LDADD = @LIB_RDLIBS@ @LIBVORBIS@
dist_stringcode_test_SOURCES = stringcode_test.cpp stringcode_test.h
stringcode_test_LDADD = @LIB_RDLIBS@ @LIBVORBIS@

View File

@ -1,188 +0,0 @@
// sas_switch_torture.cpp
//
// A Qt-based application for playing Microsoft WAV files.
//
// (C) Copyright 2002-2005,2016 Fred Gleason <fredg@paravelsystems.com>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public
// License along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#include <stdlib.h>
#include <unistd.h>
#include <qapplication.h>
#include <qpushbutton.h>
#include <qmessagebox.h>
#include <qdatetime.h>
#include <rd.h>
#include <rddb.h>
#include <sas_switch_torture.h>
#include <rdescape_string.h>
MainWidget::MainWidget(QWidget *parent)
:QWidget(parent)
{
unsigned schema=0;
//
// Fix the Window Size
//
setMinimumWidth(sizeHint().width());
setMaximumWidth(sizeHint().width());
setMinimumHeight(sizeHint().height());
setMaximumHeight(sizeHint().height());
//
// Generate Fonts
//
QFont font("Helvetica",12,QFont::Normal);
font.setPixelSize(12);
//
// Open Database
//
rd_config=new RDConfig(RD_CONF_FILE);
rd_config->load();
rd_config->setModuleName("sas_switch_torture");
QString err;
test_db=RDInitDb(&schema,&err);
if(!test_db) {
QMessageBox::warning(this,"Can't Connect",
err,0,1,1);
exit(0);
}
//
// Generate Button
//
QPushButton *button=new QPushButton(this,"generate_button");
button->setGeometry(10,10,sizeHint().width()-20,50);
button->setText("Generate Test");
button->setFont(font);
connect(button,SIGNAL(clicked()),this,SLOT(generateData()));
//
// Remove Button
//
button=new QPushButton(this,"remove_button");
button->setGeometry(10,70,sizeHint().width()-20,50);
button->setText("Remove Test");
button->setFont(font);
connect(button,SIGNAL(clicked()),this,SLOT(removeData()));
//
// Exit Button
//
button=new QPushButton(this,"cancel_button");
button->setGeometry(10,130,sizeHint().width()-20,50);
button->setText("Exit");
button->setFont(font);
connect(button,SIGNAL(clicked()),this,SLOT(cancelData()));
}
QSize MainWidget::sizeHint() const
{
return QSize(200,190);
}
QSizePolicy MainWidget::sizePolicy() const
{
return QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
}
void MainWidget::generateData()
{
QString sql;
RDSqlQuery *q;
QString rml;
QString desc;
//
// Create Schedule
//
QTime time;
for(int i=0;i<86400000;i+=TIME_INTERVAL) {
for(int j=0;j<SAS_INPUTS;j++) {
for(int k=0;k<SAS_OUTPUTS;k++) {
desc=QString().sprintf("Switch SAS Output %d",j+1);
sql=QString().sprintf("insert into RECORDINGS set STATION_NAME=\"%s\",\
CHANNEL=%d,SWITCH_INPUT=%d,SWITCH_OUTPUT=%d,\
SUN=\'Y\',MON=\'Y\',TUE=\'Y\',WED=\'Y\',THU=\'Y\',\
FRI=\'Y\',SAT=\'Y\',DESCRIPTION=\"%s\",\
CUT_NAME=\"SAS_SWITCH_TORTURE\",\
START_TIME=%s,TYPE=1",
SAS_STATION,
SAS_MATRIX,
j+1,
k+1,
(const char *)desc,
(const char *)RDCheckDateTime(time,"hh:mm:ss"));
q=new RDSqlQuery(sql);
delete q;
}
}
time=time.addMSecs(TIME_INTERVAL);
}
}
void MainWidget::removeData()
{
QString sql;
RDSqlQuery *q;
//
// Delete Carts
//
sql=QString("delete from CART where ARTIST=\"SAS_SWITCH_TORTURE\"");
q=new RDSqlQuery(sql);
delete q;
//
// Delete Schedule
//
sql=QString("delete from RECORDINGS where CUT_NAME=\"SAS_SWITCH_TORTURE\"");
q=new RDSqlQuery(sql);
delete q;
}
void MainWidget::cancelData()
{
qApp->quit();
}
void MainWidget::closeEvent(QCloseEvent *e)
{
cancelData();
}
int main(int argc,char *argv[])
{
QApplication a(argc,argv);
MainWidget *w=new MainWidget();
a.setMainWidget(w);
w->setGeometry(QRect(QPoint(0,0),w->sizeHint()));
w->show();
return a.exec();
}

View File

@ -1,60 +0,0 @@
// sas_switch_torture.h
//
// Generate Rivendell macro carts and scheduling for torture-testing
// an SAS router
//
// (C) Copyright 2002-2004,2016 Fred Gleason <fredg@paravelsystems.com>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public
// License along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#ifndef SAS_SWITCH_TORTURE_H
#define SAS_SWITCH_TORTURE_H
#include <qwidget.h>
#include <qsqldatabase.h>
#include <rdconfig.h>
#define SAS_INPUTS 32
#define SAS_OUTPUTS 16
#define SAS_STATION "hithlum"
#define SAS_MATRIX 1
#define SAS_SLEEP 20
#define CART_START 10000
#define TIME_INTERVAL 2000
class MainWidget : public QWidget
{
Q_OBJECT
public:
MainWidget(QWidget *parent=0);
QSize sizeHint() const;
QSizePolicy sizePolicy() const;
private slots:
void generateData();
void removeData();
void cancelData();
void closeEvent(QCloseEvent *e);
private:
QSqlDatabase *test_db;
QString test_filename;
RDConfig *rd_config;
};
#endif // SAS_SWITCH_TORTURE_H

View File

@ -1,200 +0,0 @@
// sas_torture.cpp
//
// A Qt-based application for playing Microsoft WAV files.
//
// (C) Copyright 2002,2016 Fred Gleason <fredg@paravelsystems.com>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public
// License along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#include <stdlib.h>
#include <unistd.h>
#include <qapplication.h>
#include <qpushbutton.h>
#include <qmessagebox.h>
#include <qdatetime.h>
#include <rd.h>
#include <rddb.h>
#include <sas_torture.h>
#include <rdescape_string.h>
MainWidget::MainWidget(QWidget *parent)
:QWidget(parent)
{
unsigned schema=0;
//
// Fix the Window Size
//
setMinimumWidth(sizeHint().width());
setMaximumWidth(sizeHint().width());
setMinimumHeight(sizeHint().height());
setMaximumHeight(sizeHint().height());
//
// Generate Fonts
//
QFont font("Helvetica",12,QFont::Normal);
font.setPixelSize(12);
//
// Open Database
//
rd_config=new RDConfig(RD_CONF_FILE);
rd_config->load();
rd_config->setModuleName("sas_torture");
QString err;
test_db=RDInitDb(&schema,&err);
if(!test_db) {
QMessageBox::warning(this,"Can't Connect",
err,0,1,1);
exit(0);
}
//
// Generate Button
//
QPushButton *button=new QPushButton(this,"generate_button");
button->setGeometry(10,10,sizeHint().width()-20,50);
button->setText("Generate Test");
button->setFont(font);
connect(button,SIGNAL(clicked()),this,SLOT(generateData()));
//
// Remove Button
//
button=new QPushButton(this,"remove_button");
button->setGeometry(10,70,sizeHint().width()-20,50);
button->setText("Remove Test");
button->setFont(font);
connect(button,SIGNAL(clicked()),this,SLOT(removeData()));
//
// Exit Button
//
button=new QPushButton(this,"cancel_button");
button->setGeometry(10,130,sizeHint().width()-20,50);
button->setText("Exit");
button->setFont(font);
connect(button,SIGNAL(clicked()),this,SLOT(cancelData()));
}
QSize MainWidget::sizeHint() const
{
return QSize(200,190);
}
QSizePolicy MainWidget::sizePolicy() const
{
return QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
}
void MainWidget::generateData()
{
QString sql;
RDSqlQuery *q;
QString rml;
QString desc;
//
// Create Carts
//
for(int i=0;i<SAS_OUTPUTS;i++) {
rml=QString();
for(int j=0;j<SAS_INPUTS;j++) {
rml+=QString().sprintf("ST %d %d %d!SP %d!",
SAS_MATRIX,j+1,i+1,SAS_SLEEP);
}
sql=QString().sprintf("insert into CART set NUMBER=%d,TYPE=2,\
GROUP_NAME=\"TEMP\",TITLE=\"Walk SAS Output %d\",\
ARTIST=\"SAS_TORTURE\",MACROS=\"%s\"",
i+CART_START,i+1,(const char *)rml);
q=new RDSqlQuery(sql);
delete q;
}
//
// Create Schedule
//
QTime time;
for(int i=0;i<86400000;i+=TIME_INTERVAL) {
for(int j=0;j<SAS_OUTPUTS;j++) {
desc=QString().sprintf("Walk SAS Output %d",j+1);
sql=QString().sprintf("insert into RECORDINGS set STATION_NAME=\"%s\",\
SUN=\'Y\',MON=\'Y\',TUE=\'Y\',WED=\'Y\',THU=\'Y\',\
FRI=\'Y\',SAT=\'Y\',DESCRIPTION=\"%s\",\
CUT_NAME=\"SAS_TORTURE\",MACRO_CART=%d,\
START_TIME=%s,TYPE=1",
SAS_STATION,
(const char *)desc,
CART_START+j,
(const char *)RDCheckDateTime(time,"hh:mm:ss"));
q=new RDSqlQuery(sql);
delete q;
}
time=time.addMSecs(TIME_INTERVAL);
}
}
void MainWidget::removeData()
{
QString sql;
RDSqlQuery *q;
//
// Delete Carts
//
sql=QString("delete from CART where ARTIST=\"SAS_TORTURE\"");
q=new RDSqlQuery(sql);
delete q;
//
// Delete Schedule
//
sql=QString("delete from RECORDINGS where CUT_NAME=\"SAS_TORTURE\"");
q=new RDSqlQuery(sql);
delete q;
}
void MainWidget::cancelData()
{
qApp->quit();
}
void MainWidget::closeEvent(QCloseEvent *e)
{
cancelData();
}
int main(int argc,char *argv[])
{
QApplication a(argc,argv);
MainWidget *w=new MainWidget();
a.setMainWidget(w);
w->setGeometry(QRect(QPoint(0,0),w->sizeHint()));
w->show();
return a.exec();
}

View File

@ -1,61 +0,0 @@
// sas_torture.h
//
// Generate Rivendell macro carts and scheduling for torture-testing
// an SAS router
//
// (C) Copyright 2002-2004,2016 Fred Gleason <fredg@paravelsystems.com>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public
// License along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#ifndef SAS_TORTURE_H
#define SAS_TORTURE_H
#include <qwidget.h>
#include <qsqldatabase.h>
#include <rdconfig.h>
#define SAS_INPUTS 32
#define SAS_OUTPUTS 16
#define SAS_STATION "hithlum"
#define SAS_MATRIX 1
#define SAS_SLEEP 20
#define CART_START 10000
#define TIME_INTERVAL 20000
class MainWidget : public QWidget
{
Q_OBJECT
public:
MainWidget(QWidget *parent=0);
QSize sizeHint() const;
QSizePolicy sizePolicy() const;
private slots:
void generateData();
void removeData();
void cancelData();
void closeEvent(QCloseEvent *e);
private:
void LoadConfig();
QSqlDatabase *test_db;
QString test_filename;
RDConfig *rd_config;
};
#endif // SAS_TORTURE_H