You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
educoder/db/init.sql

5532 lines
194 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

SET FOREIGN_KEY_CHECKS = 0;
DROP TABLE IF EXISTS `repertoires`;
CREATE TABLE `repertoires` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) DEFAULT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;
insert into `repertoires`(`id`,`name`,`created_at`,`updated_at`) values
(1,'前端开发','2018-02-08 15:12:08','2018-05-11 17:14:07'),
(2,'后端开发','2018-02-08 15:12:17','2018-05-11 17:14:04'),
(3,'移动开发','2018-02-08 15:12:24','2018-05-11 17:14:03'),
(4,'数据库','2018-02-08 15:12:28','2018-05-11 17:14:01'),
(5,'云计算和大数据','2018-02-08 15:12:39','2018-05-11 17:13:59'),
(6,'运维与测试','2018-02-08 15:12:46','2018-05-11 17:13:56'),
(8,'其它','2018-02-08 15:13:03','2018-05-11 17:13:42'),
(9,'人工智能','2018-04-13 17:36:23','2018-05-11 17:13:54');
DROP TABLE IF EXISTS `sub_repertoires`;
CREATE TABLE `sub_repertoires` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) DEFAULT NULL,
`repertoire_id` int(11) DEFAULT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
PRIMARY KEY (`id`),
KEY `index_sub_repertoires_on_repertoire_id` (`repertoire_id`)
) ENGINE=InnoDB AUTO_INCREMENT=31 DEFAULT CHARSET=utf8;
insert into `sub_repertoires`(`id`,`name`,`repertoire_id`,`created_at`,`updated_at`) values
(1,'前端基础',1,'2018-02-08 15:13:18','2018-05-11 17:14:34'),
(3,'前端框架',1,'2018-02-08 15:13:29','2018-05-11 17:14:32'),
(5,'应用开发',3,'2018-02-08 15:13:59','2018-02-08 15:13:59'),
(9,'SQL',4,'2018-02-08 15:14:24','2018-02-08 15:14:24'),
(13,'云计算',5,'2018-02-08 15:14:58','2018-05-11 17:14:40'),
(14,'大数据',5,'2018-02-08 15:15:02','2018-05-11 17:14:42'),
(16,'Linux运维',6,'2018-02-08 15:15:14','2018-05-11 17:14:44'),
(17,'网络',6,'2018-02-08 15:15:26','2018-05-11 17:14:45'),
(18,'测试工具',6,'2018-02-08 15:15:32','2018-05-11 17:14:47'),
(19,'计算机课程',8,'2018-02-08 15:15:46','2018-02-08 15:15:46'),
(20,'Python',2,'2018-04-08 10:55:28','2018-05-11 17:13:07'),
(21,'PHP',2,'2018-04-08 10:56:13','2018-05-11 17:13:02'),
(22,'Java',2,'2018-04-08 11:02:55','2018-05-11 17:13:09'),
(23,'Ruby',2,'2018-04-08 11:03:52','2018-05-11 17:12:59'),
(24,'ASP.NET',2,'2018-04-08 11:04:27','2018-05-11 17:12:30'),
(25,'Go',2,'2018-04-08 11:05:11','2018-05-11 17:13:00'),
(26,'更多',2,'2018-04-08 11:06:46','2018-05-11 17:12:27'),
(27,'人工智能',9,'2018-04-13 17:36:23','2018-04-13 17:39:53'),
(29,'C',2,'2018-05-11 09:23:14','2018-05-11 17:13:06'),
(30,'C++',2,'2018-05-11 09:28:02','2018-05-11 17:13:04');
DROP TABLE IF EXISTS `tag_repertoires`;
CREATE TABLE `tag_repertoires` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) DEFAULT NULL,
`sub_repertoire_id` int(11) DEFAULT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=168 DEFAULT CHARSET=utf8;
insert into `tag_repertoires`(`id`,`name`,`sub_repertoire_id`,`created_at`,`updated_at`) values
(1,'HTML',1,'2018-04-08 10:18:27','2018-05-11 17:15:11'),
(2,'CSS',1,'2018-04-08 10:18:33','2018-05-11 17:15:09'),
(3,'Html5',1,'2018-04-08 10:18:39','2018-05-11 17:15:08'),
(4,'CSS3',1,'2018-04-08 10:18:45','2018-05-11 17:15:06'),
(5,'JavaScript',1,'2018-04-08 10:18:50','2019-02-22 09:35:30'),
(10,'Bootstrap',3,'2018-04-08 10:19:22','2018-04-08 10:19:22'),
(13,'AngularJS',3,'2018-04-08 10:30:47','2018-04-08 10:30:47'),
(14,'Aurelia',3,'2018-04-08 10:30:58','2018-04-08 10:30:58'),
(15,'Backbone',3,'2018-04-08 10:31:10','2018-04-08 10:31:10'),
(16,'d3.js',3,'2018-04-08 10:31:17','2018-04-08 10:31:17'),
(18,'Dojo 2',3,'2018-04-08 10:31:58','2018-04-08 10:31:58'),
(20,'Ember.js',3,'2018-04-08 10:40:36','2018-04-08 10:40:36'),
(21,'Ext JS',3,'2018-04-08 10:40:43','2018-04-08 10:40:43'),
(23,'Gulp',3,'2018-04-08 10:50:20','2018-04-08 10:50:20'),
(24,'Ionic',3,'2018-04-08 10:50:25','2018-04-08 10:50:25'),
(26,'Knockout',3,'2018-04-08 10:50:38','2018-04-08 10:50:38'),
(27,'MDLMaterial Design Lite',3,'2018-04-08 10:50:54','2018-04-08 10:50:54'),
(28,'MooTools',3,'2018-04-08 10:50:59','2018-04-08 10:50:59'),
(30,'Rails',3,'2018-04-08 10:51:11','2018-04-08 10:51:11'),
(31,'React.JS',3,'2018-04-08 10:51:18','2018-04-08 10:51:18'),
(32,'ReactNative',3,'2018-04-08 10:51:26','2018-04-08 10:51:26'),
(33,'redux',3,'2018-04-08 10:51:32','2018-04-08 10:51:32'),
(34,'RxJS',3,'2018-04-08 10:51:36','2018-04-08 10:51:36'),
(35,'Less',3,'2018-04-08 10:51:40','2018-04-08 10:51:40'),
(36,'Sass',3,'2018-04-08 10:51:44','2018-04-08 10:51:44'),
(37,'Underscore',3,'2018-04-08 10:51:50','2018-04-08 10:51:50'),
(38,'Vue.js',3,'2018-04-08 10:51:54','2018-04-08 10:51:54'),
(39,'Hogan.js',3,'2018-04-08 10:51:59','2018-04-08 10:51:59'),
(40,'Zebra',3,'2018-04-08 10:52:06','2018-04-08 10:52:06'),
(43,'Meteor',3,'2018-04-08 10:52:30','2018-04-08 10:52:30'),
(46,'Python基础',20,'2018-04-08 10:55:46','2018-05-15 14:55:30'),
(47,'web2py',20,'2018-04-08 10:55:50','2018-05-15 14:55:27'),
(48,'Django',20,'2018-04-08 10:55:55','2018-05-15 14:55:26'),
(49,'Flask',20,'2018-04-08 10:56:00','2018-05-15 14:55:25'),
(50,'数据挖掘与分析',20,'2018-04-08 10:56:05','2018-05-15 14:55:24'),
(51,'PHP基础',21,'2018-04-08 10:56:20','2018-05-11 17:19:00'),
(52,'ThinkPHP',21,'2018-04-08 10:56:25','2018-05-11 17:18:59'),
(53,'Laravel',21,'2018-04-08 10:56:29','2018-05-11 17:18:58'),
(54,'WordPress',21,'2018-04-08 10:56:34','2018-05-11 17:18:57'),
(56,'Java基础',22,'2018-04-08 11:03:09','2018-05-11 17:19:25'),
(57,'JSP',22,'2018-04-08 11:03:14','2018-05-11 17:19:24'),
(59,'Spring',22,'2018-04-08 11:03:23','2018-05-11 17:19:23'),
(60,'Struts2',22,'2018-04-08 11:03:28','2018-05-11 17:19:22'),
(61,'MyBatis',22,'2018-04-08 11:03:33','2018-05-11 17:19:21'),
(62,'Hibernate',22,'2018-04-08 11:03:37','2018-05-11 17:19:20'),
(63,'Lucene',22,'2018-04-08 11:03:42','2018-05-11 17:19:19'),
(64,'Ruby基础',23,'2018-04-08 11:03:58','2018-05-11 17:19:07'),
(65,'Ruby on Rails',23,'2018-04-08 11:04:04','2018-05-11 17:19:06'),
(66,'Grape',23,'2018-04-08 11:04:09','2018-05-11 17:19:05'),
(67,'Ruby进阶',23,'2018-04-08 11:04:13','2018-05-11 17:19:04'),
(68,'RubyMine',23,'2018-04-08 11:04:18','2018-05-11 17:19:03'),
(69,'C#',24,'2018-04-08 11:04:43','2018-04-08 11:04:43'),
(70,'ASP.NET MVC',24,'2018-04-08 11:04:47','2018-04-08 11:04:47'),
(71,'Entity Framework',24,'2018-04-08 11:04:55','2018-04-08 11:04:55'),
(72,'WPF',24,'2018-04-08 11:05:00','2018-04-08 11:05:00'),
(73,'Go基础',25,'2018-04-08 11:05:21','2018-04-08 11:05:21'),
(78,'R',26,'2018-04-08 11:07:03','2018-04-08 11:07:03'),
(79,'Perl',26,'2018-04-08 11:07:09','2018-04-08 11:07:09'),
(80,'YAML',26,'2018-04-08 11:07:17','2018-04-08 11:07:17'),
(82,'Kotlin',26,'2018-04-08 11:07:28','2018-04-08 11:07:28'),
(86,'Android',5,'2018-04-08 11:07:57','2018-05-11 17:19:12'),
(87,'IOS',5,'2018-04-08 11:08:03','2018-05-11 17:19:11'),
(88,'MySQL',9,'2018-04-08 11:08:23','2018-05-21 09:16:30'),
(89,'SQL Server',9,'2018-04-08 11:08:28','2018-05-21 09:16:29'),
(90,'Oracle',9,'2018-04-08 11:08:32','2018-05-21 09:16:27'),
(91,'SQLite',9,'2018-04-08 11:08:36','2018-05-21 09:16:26'),
(92,'PostgreSQL',9,'2018-04-08 11:08:41','2018-05-21 09:16:25'),
(93,'DB2',9,'2018-04-08 11:08:45','2018-05-21 09:16:24'),
(102,'OpenStack',13,'2018-04-08 11:10:15','2018-04-08 11:10:15'),
(103,'Docker',13,'2018-04-08 11:10:20','2018-04-08 11:10:20'),
(104,'Hadoop',14,'2018-04-08 11:10:28','2018-06-22 13:23:49'),
(105,'Spark',14,'2018-04-08 11:10:32','2018-06-22 13:23:48'),
(106,'Hive',14,'2018-04-08 11:10:36','2018-06-22 13:23:47'),
(107,'Kafka',14,'2018-04-08 11:10:40','2018-06-22 13:23:45'),
(108,'Zookeeper',14,'2018-04-08 11:10:45','2018-06-22 13:23:46'),
(109,'Hbase',14,'2018-04-08 11:10:49','2018-06-22 13:23:43'),
(110,'Mahout',14,'2018-04-08 11:10:54','2018-06-22 13:23:42'),
(111,'Scala',14,'2018-04-08 11:10:59','2018-06-22 13:23:41'),
(112,'SDN',14,'2018-04-08 11:11:09','2018-06-22 13:23:40'),
(113,'Elasticsearch',14,'2018-04-08 11:11:15','2018-06-22 13:23:39'),
(114,'Linux',16,'2018-04-08 11:11:35','2018-04-08 11:11:35'),
(115,'Shell',16,'2018-04-08 11:11:39','2018-04-08 11:11:39'),
(116,'Nginx',16,'2018-04-08 11:11:47','2018-04-08 11:11:47'),
(117,'Ansible',16,'2018-04-08 11:11:51','2018-04-08 11:11:51'),
(118,'Git',16,'2018-04-08 11:11:55','2018-04-08 11:11:55'),
(119,'Dynamips',17,'2018-04-08 11:12:00','2018-04-08 11:12:00'),
(120,'VNC',17,'2018-04-08 11:12:05','2018-04-08 11:12:05'),
(121,'Socket.io',17,'2018-04-08 11:12:09','2018-04-08 11:12:09'),
(122,'Jmeter',18,'2018-04-08 11:12:15','2018-04-08 11:12:15'),
(123,'Check',18,'2018-04-08 11:12:21','2018-04-08 11:12:21'),
(124,'CPPUnit',18,'2018-04-08 11:12:24','2018-04-08 11:12:24'),
(125,'CUnit',18,'2018-04-08 11:12:28','2018-04-08 11:12:28'),
(126,'CuTest',18,'2018-04-08 11:12:32','2018-04-08 11:12:32'),
(127,'Junit',18,'2018-04-08 11:12:37','2018-04-08 11:12:37'),
(128,'Mocha',18,'2018-04-08 11:12:41','2018-04-08 11:12:41'),
(129,'Rspec',18,'2018-04-08 11:12:45','2018-04-08 11:12:45'),
(130,'Selenium',18,'2018-04-08 11:12:49','2018-04-08 11:12:49'),
(131,'unittest',18,'2018-04-08 11:12:53','2018-04-08 11:12:53'),
(132,'Watir',18,'2018-04-08 11:12:59','2018-04-08 11:12:59'),
(133,'Verilog',19,'2018-04-08 11:14:12','2018-05-11 17:16:02'),
(134,'Matlab',19,'2018-04-08 11:14:17','2018-05-11 17:16:01'),
(135,'VHDL',19,'2018-04-13 16:29:29','2018-05-11 17:15:59'),
(136,'Jfinal',22,'2018-04-13 16:41:56','2018-05-11 17:19:18'),
(142,'机器学习',27,'2018-04-13 17:39:32','2018-05-16 14:14:06'),
(144,'深度学习',27,'2018-04-13 17:40:04','2018-05-16 14:14:04'),
(145,'信号与系统',19,'2018-04-17 11:34:29','2018-05-11 17:15:58'),
(146,'大学计算机基础',19,'2018-05-08 17:15:48','2018-05-11 17:15:57'),
(148,'其它',19,'2018-05-11 08:34:57','2018-05-11 17:15:56'),
(151,'jQuery',1,'2018-05-11 09:20:15','2018-05-11 17:15:04'),
(152,'C语言基础',29,'2018-05-11 09:26:55','2018-05-11 09:27:23'),
(160,'C++基础',30,'2018-05-11 09:28:17','2018-05-11 17:18:55'),
(161,'C++图像处理',30,'2018-05-11 11:07:29','2018-05-11 17:18:53'),
(162,'Node.js',3,'2018-05-11 11:11:22','2018-05-11 11:11:22'),
(163,'MongoDB',9,'2018-05-11 11:17:36','2018-08-27 08:43:34'),
(164,'Redis',9,'2018-05-11 11:17:58','2018-05-21 09:16:21'),
(165,'汇编',26,'2019-02-21 13:56:34','2019-02-21 13:56:34'),
(166,'Flink',14,'2019-06-18 08:13:38','2019-06-18 08:13:38'),
(167,'图形化工具',19,'2019-07-23 15:36:36','2019-07-23 15:36:36');
DROP TABLE IF EXISTS `portal_images`;
CREATE TABLE `portal_images` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) DEFAULT NULL,
`position` int(11) DEFAULT NULL,
`link` varchar(255) DEFAULT NULL,
`status` tinyint(1) DEFAULT '0',
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;
insert into `portal_images`(`id`,`name`,`position`,`link`,`status`,`created_at`,`updated_at`) values
(1,'云启校园计划',1,'https://ecloud.10086.cn/market/marketStu',0,'2018-08-24 14:21:53','2019-06-29 20:13:05'),
(3,'CCF教学案例征集',3,'https://www.educoder.net/competitions/ccf-se-2018',0,'2018-08-24 14:23:04','2018-12-14 14:18:50'),
(4,'Java路径',4,'https://www.educoder.net/paths/54',0,'2018-08-24 14:23:23','2019-02-03 19:44:42'),
(5,'Python路径',5,'https://www.educoder.net/paths/11',1,'2018-08-24 14:23:39','2018-08-24 14:24:22'),
(6,'云计算大数据',6,'https://www.educoder.net/paths/29',1,'2018-08-24 14:24:08','2018-08-24 14:24:39'),
(7,'C语言精品课程',3,'https://www.educoder.net/paths/196 ',0,'2019-02-02 19:21:48','2019-06-29 20:14:03'),
(8,'北京大学aixcoder',3,'http://www.aixcoder.com/help/educoder',1,'2019-04-30 14:50:06','2019-06-29 20:13:40'),
(9,'2019绿盟杯竞赛',1,'https://forge.educoder.net/competitions',1,'2019-06-29 10:06:06','2019-07-22 15:02:20');
DROP TABLE IF EXISTS `mirror_repositories`;
CREATE TABLE `mirror_repositories` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`mirrorID` varchar(255) DEFAULT NULL,
`name` varchar(255) DEFAULT NULL,
`main_type` varchar(255) DEFAULT NULL,
`description` text,
`status` int(11) DEFAULT '0',
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
`type_name` text,
`script_template` longtext,
`resource_limit` int(11) DEFAULT '10000',
`memory_limit` int(11) DEFAULT '1024',
`cpu_limit` tinyint(4) DEFAULT '1',
`time_limit` int(11) DEFAULT '120',
`should_compile` tinyint(1) DEFAULT NULL,
`repertoire_id` int(11) DEFAULT NULL,
`sub_repertoire_id` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=128 DEFAULT CHARSET=utf8;
insert into `mirror_repositories`(`id`,`mirrorID`,`name`,`main_type`,`description`,`status`,`created_at`,`updated_at`,`type_name`,`script_template`,`resource_limit`,`memory_limit`,`cpu_limit`,`time_limit`,`should_compile`,`repertoire_id`,`sub_repertoire_id`) values
(2,'5d789e5d495f','python3-ssh:v1.0','1','python3.6.2ssh',1,'2018-01-29 11:31:25','2019-07-30 17:43:21','Python3.6','#!/bin/bash
cd WORKSPACE
#前台传来的可执行文件,即测试文件
sourceClassNames=(SOURCECLASSNAMES)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
#不需要编译,设定编译结果为成功编译
compileResult=$(echo -n "compile successfully" | base64)
echo \'ulimit -f 10000\' >>/root/.bashrc ; source /root/.bashrc
execute(){
executeCommand="python3.6 "
sourceClassName=${sourceClassNames[$1 - 1]}
challengeStage=$1
#get the loop times(looptimes = the num of testdataset)
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
#执行,并拼接执行结果
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
#拼接输出结果
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
#return result in json format
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output}"
echo $result
}
#拼装成最终的json格式echo输出得到最后结果
returnResult
',100000,2048,2,85,0,2,4),
(3,'42bd3e1427cc','cisco-ssh:v1.0','1','dynagen0.11.0dynamips0.2.8ssh',1,'2018-01-29 11:31:25','2019-06-25 14:13:24','Dynamips','#!/bin/bash
cd WORKSPACE
#前台传来的可执行文件,即测试文件
sourceClassNames=(SOURCECLASSNAMES)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
#不需要编译,设定编译结果为成功编译
compileResult=$(echo -n "compile successfully" | base64)
#echo \'ulimit -f 10000\' >>/root/.bashrc ; source /root/.bashrc
execute(){
executeCommand="bash "
sourceClassName=${sourceClassNames[$1 - 1]}
challengeStage=$1
#get the loop times(looptimes = the num of testdataset)
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
#执行,并拼接执行结果
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
#拼接输出结果
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
#return result in json format
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output}"
echo $result
}
#拼装成最终的json格式echo输出得到最后结果
returnResult
',100000,1024,1,120,0,6,17),
(4,'b21be9214e36','python2-ssh:v1.0','1','python2.7.9ssh',1,'2018-01-29 11:31:25','2019-06-25 14:17:20','Python2.7','#!/bin/bash
cd WORKSPACE
#前台传来的可执行文件,即测试文件
sourceClassNames=("" "" "")
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
#不需要编译,设定编译结果为成功编译
compileResult=$(echo -n "compile successfully" | base64)
echo \'ulimit -f 10000\' >>/root/.bashrc ; source /root/.bashrc
execute(){
executeCommand="python2.7 "
sourceClassName=${sourceClassNames[$1 - 1]}
challengeStage=$1
#get the loop times(looptimes = the num of testdataset)
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
#执行,并拼接执行结果
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
#拼接输出结果
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
#return result in json format
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output}"
echo $result
}
#拼装成最终的json格式echo输出得到最后结果
returnResult
',100000,1024,1,120,0,2,4),
(5,'eb55c2848120','openjdk-ssh:v1.0','1','java1.8.0zookeeper3.4.12',1,'2018-01-29 11:31:25','2019-07-16 17:48:22','Java','#!/bin/bash
#工作空间
cd WORKSPACE
#用户打开的文件名,之所以传过来这个,是因为可以从这个里面提取出来执行文件名
challengeProgramNames=(CHALLENGEPROGRAMNAMES)
#执行文件名
sourceClassNames=(SOURCECLASSNAMES)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
#限制每个shell连接所能写文件的最大容量100M
echo \'ulimit -f 10000\' >>/root/.bashrc ; source /root/.bashrc
compile(){
#编译命令,有的语言是没有编译过程,这个时候默认编译成功
compileCommand="javac -encoding UTF-8 -Djava.ext.dirs=./lib/ -sourcepath src/ -d target/"
#取当前关卡的编译文件
challengeProgramName=${challengeProgramNames[$1 - 1]}
#当前关卡,作为参数传进来
challengeStage=$1
#删除上一次编译生成的文件,防止对本次编译造成影响
rm -f ./target/step$challengeStage/*.class &> /dev/null
# 获取编译结果(此处编译无输出则说明编译通过,否则输出编译错误信息,请按实训实际情况调整)
compileResult=$($compileCommand $challengeProgramName 2>&1 | base64)
if [ -z "$compileResult" ]; then
compileResult=$(echo -n "compile successfully" | base64)
fi
}
compile $1
execute(){
#执行命令
executeCommand="java -Dfile.encoding=UTF-8 -Djava.ext.dirs=./lib/ -cp target/"
#执行文件名
sourceClassName=${sourceClassNames[$1 - 1]}
challengeStage=$1
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
#执行,并拼接执行结果
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
#拼接输出结果
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
#return result in json format
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output}"
echo $result
}
#拼装成最终的json格式echo输出得到最后结果
returnResult
',100000,1024,1,50,1,2,4),
(6,'3a0adda6b05f','hive-ssh:v1.0','1','hive-2.3.2ssh',1,'2018-01-29 11:31:25','2019-07-12 09:26:20','Hive',null,100000,2500,2,120,0,5,14),
(7,'c3cac044d76a','hadoop-ssh:v1.0','1','jdk8ant1.10.1hadoop2.7.4ssh 伪分布式',1,'2018-01-29 11:31:25','2019-06-25 14:19:55','Hadoop','#!/bin/bash
#工作空间
cd WORKSPACE
#用户打开的文件名,之所以传过来这个,是因为可以从这个里面提取出来执行文件名
challengeProgramNames=(CHALLENGEPROGRAMNAMES)
#执行文件名
sourceClassNames=(SOURCECLASSNAMES)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
#限制每个shell连接所能写文件的最大容量100M
echo \'ulimit -f 10000\' >>/root/.bashrc ; source /root/.bashrc
compile(){
cd step$1
#编译命令,有的语言是没有编译过程,这个时候默认编译成功
compileCommand="/apache-ant-1.10.1/bin/ant -q -S"
#取当前关卡的编译文件
challengeProgramName=${challengeProgramNames[$1 - 1]}
#当前关卡,作为参数传进来
challengeStage=$1
############################################
compileResult=$($compileCommand 2>&1)
echo $compileResult |grep \'BUILD FAILED\' >/dev/null
if [[ $? == 0 ]]; then
compileResult=$(echo -n $compileResult | base64)
else
compileResult=$(echo -n "compile successfully" | base64)
fi
}
compile $1
execute(){
#执行命令
executeCommand="sh $1.sh"
#执行文件名
sourceClassName=${sourceClassNames[$1 - 1]}
challengeStage=$1
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
#执行,并拼接执行结果
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
#拼接输出结果
output=$output\\"$(cat /tmp/output/part-r-00000 2>/dev/null | base64)\\",
let i++
done
output="[${output%?}]"
}
execute $1
#return result in json format
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output}"
echo $result
}
#拼装成最终的json格式echo输出得到最后结果
returnResult
',100000,2048,1,120,1,5,14),
(8,'a48703cc8a4b','sdl2-vnc:v1.0','1','sdl2vncssh',1,'2018-01-29 11:31:25','2019-06-25 14:18:36','SDL',null,100000,1024,1,120,1,2,null),
(9,'6293d9c4ae5b','php-ssh:v1.0','1','php7.1.10ssh',1,'2018-01-29 11:31:25','2019-06-25 14:16:23','PHP','#!/bin/bash
cd WORKSPACE
#前台传来的可执行文件,即测试文件
sourceClassNames=("src/step1/SafeDataFillingTest.php" "src/step2/RequiredFieldsTest.php" "src/step3/ValidationOfLegitimacyTest.php" "src/step4/FormDemoTest.php")
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
#不需要编译,设定编译结果为成功编译
compileResult=$(echo -n "compile successfully" | base64)
echo \'ulimit -f 10000\' >>/root/.bashrc ; source /root/.bashrc
#启动php自建web服务器端口为80
runserver(){
count=`ps -ef | grep php | grep -v grep | wc -l`
if [ 0 -eq $count ]; then
nohup php -S 0.0.0.0:8080 &> /dev/null &
fi
}
runserver
execute(){
executeCommand="php"
sourceClassName=${sourceClassNames[$1 - 1]}
challengeStage=$1
#get the loop times(looptimes = the num of testdataset)
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
#执行,并拼接执行结果
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
#拼接输出结果
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
#return result in json format
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output}"
echo $result
}
#拼装成最终的json格式echo输出得到最后结果
returnResult
',100000,1024,1,120,0,2,4),
(10,'d94b9367b952','octave-novnc:v1.0','1','octave4.2.1novnc',1,'2018-01-29 11:31:25','2019-06-25 14:15:43','Matlab','#!/bin/bash
cd WORKSPACE
#前台传来的可执行文件,即测试文件
sourceClassNames=("step1/f_t_1_c.m" "step2/f_t_2.m")
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
#不需要编译,设定编译结果为成功编译
compileResult=$(echo -n "compile successfully" | base64)
echo \'ulimit -f 10000\' >>/root/.bashrc ; source /root/.bashrc
execute(){
executeCommand="octave "
sourceClassName=${sourceClassNames[$1 - 1]}
challengeStage=$1
#get the loop times(looptimes = the num of testdataset)
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
#执行,并拼接执行结果
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 |grep -vE "warning: function|octave: unable|octave: disabling" | base64)
#拼接输出结果
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
#return result in json format
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output}"
echo $result
}
#拼装成最终的json格式echo输出得到最后结果
returnResult
',100000,2048,1,120,0,8,19),
(12,'c64a7e3a4b1c','git-ssh:v1.0','1','git2.1.4ssh',1,'2018-01-29 11:31:25','2019-06-25 14:13:38','Git','#!/bin/bash
cd WORKSPACE
#前台传来的可执行文件,即测试文件
sourceClassNames=(SOURCECLASSNAMES)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
#不需要编译,设定编译结果为成功编译
compileResult=$(echo -n "compile successfully" | base64)
echo \'ulimit -f 10000\' >>/root/.bashrc ; source /root/.bashrc
execute(){
executeCommand="python "
sourceClassName=${sourceClassNames[$1 - 1]}
challengeStage=$1
#get the loop times(looptimes = the num of testdataset)
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
#执行,并拼接执行结果
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
#拼接输出结果
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
#return result in json format
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output}"
echo $result
}
#拼装成最终的json格式echo输出得到最后结果
returnResult
',100000,1024,1,120,0,6,16),
(13,'e19fc2ec6bb8','gcc-ssh:v1.0','1','gcc7.2.0boost1.66.0opencv3.4.1ssh',1,'2018-01-29 11:31:25','2019-06-25 14:19:52','C/C++','#!/bin/bash
cd WORKSPACE
challengeProgramNames=("src/step1/test.cpp")
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
echo \'ulimit -f 1000000\' >>/root/.bashrc ; source /root/.bashrc
compile(){
compileCommand="g++ "
challengeProgramName=${challengeProgramNames[$1 - 1]}
#remove the executeFile.out file that last time remains
rm -f ./executeFile.out &> /dev/null
#compile all .c file in the source folder: a/b/c.cpp --> a/b/*.cpp
challengeProgramName=${challengeProgramName%/*.cpp}"/*.cpp"
# 获取编译结果(此处编译无输出则说明编译通过,否则输出编译错误信息,请按实训实际情况调整)
compileResult=$($compileCommand $challengeProgramName -o executeFile.out 2>&1 | base64)
if [ -z "$compileResult" ]; then
compileResult=$(echo -n "compile successfully" | base64)
fi
}
compile $1
execute(){
executeCommand="./executeFile.out"
challengeStage=$1
#get the loop times(looptimes = the num of testdataset)
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
#执行,并拼接执行结果
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand | base64)
#拼接输出结果
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
#return result in json format
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output}"
echo $result
}
#拼装成最终的json格式echo输出得到最后结果
returnResult
',100000,1024,1,40,1,2,4),
(14,'f953dd677e85','ruby-ssh:v1.0','1','ruby2.3.1rails5.2.0ssh',1,'2018-01-29 11:31:25','2019-06-25 14:18:33','Ruby','#!/bin/bash
cd WORKSPACE
#前台传来的可执行文件,即测试文件
sourceClassNames=("")
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
#不需要编译,设定编译结果为成功编译
compileResult=$(echo -n "compile successfully" | base64)
echo \'ulimit -f 10000\' >>/root/.bashrc ; source /root/.bashrc
execute(){
executeCommand="ruby "
sourceClassName=${sourceClassNames[$1 - 1]}
challengeStage=$1
#get the loop times(looptimes = the num of testdataset)
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
#执行,并拼接执行结果
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
#拼接输出结果
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
#return result in json format
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output}"
echo $result
}
#拼装成最终的json格式echo输出得到最后结果
returnResult
',100000,1024,1,120,0,2,null),
(15,'e56c4315f99c','ubuntu16-ssh:v1.0','1','ubuntu16.04ssh',1,'2018-01-29 11:31:25','2019-06-25 14:18:39','Shell','#!/bin/bash
cd WORKSPACE
#前台传来的可执行文件,即测试文件
sourceClassNames=("" "" "" "" "" "")
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
#不需要编译,设定编译结果为成功编译
compileResult=$(echo -n "compile successfully" | base64)
echo \'ulimit -f 10000\' >>/root/.bashrc ; source /root/.bashrc
execute(){
executeCommand="bash "
sourceClassName=${sourceClassNames[$1 - 1]}
challengeStage=$1
#get the loop times(looptimes = the num of testdataset)
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
#执行,并拼接执行结果
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
#拼接输出结果
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
#return result in json format
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output}"
echo $result
}
#拼装成最终的json格式echo输出得到最后结果
returnResult
',100000,1024,1,120,0,6,16),
(16,'316a8a646cdb','node-ssh:v1.0','1','node9.3.0python2python3htmlhint0.9.13csslint1.0.4ssh',1,'2018-01-29 11:31:25','2019-06-25 14:15:27','JavaScript','#!/bin/bash
cd WORKSPACE
#前台传来的可执行文件,即测试文件
sourceClassNames=("" "" "VariableTest.py")
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
#不需要编译,设定编译结果为成功编译
compileResult=$(echo -n "compile successfully" | base64)
echo \'ulimit -f 10000\' >>/root/.bashrc ; source /root/.bashrc
execute(){
executeCommand="node "
sourceClassName=${sourceClassNames[$1 - 1]}
challengeStage=$1
#get the loop times(looptimes = the num of testdataset)
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
#执行,并拼接执行结果
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
#拼接输出结果
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
#return result in json format
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output}"
echo $result
}
#拼装成最终的json格式echo输出得到最后结果
returnResult
',100000,1024,1,120,0,1,1),
(17,'6e04f44485a9','perl6-ssh:v1.0','1','perl6ssh',1,'2018-01-29 11:31:25','2019-06-25 14:16:20','Perl6','#!/bin/bash
cd WORKSPACE
#前台传来的可执行文件,即测试文件
sourceClassNames=("src/step1/first.pl" "")
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
#不需要编译,设定编译结果为成功编译
compileResult=$(echo -n "compile successfully" | base64)
echo \'ulimit -f 10000\' >>/root/.bashrc ; source /root/.bashrc
execute(){
executeCommand="perl6 "
sourceClassName=${sourceClassNames[$1 - 1]}
challengeStage=$1
#get the loop times(looptimes = the num of testdataset)
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
#执行,并拼接执行结果
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
#拼接输出结果
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
#return result in json format
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output}"
echo $result
}
#拼装成最终的json格式echo输出得到最后结果
returnResult
',100000,1024,1,120,0,2,null),
(18,'4e82c3efd0fb','kotlin-ssh:v1.0','1','kotlin1.2.20ssh',1,'2018-01-29 11:31:25','2019-06-25 14:15:34','Kotlin','#!/bin/bash
#工作空间
cd WORKSPACE
#用户打开的文件名,之所以传过来这个,是因为可以从这个里面提取出来执行文件名
challengeProgramNames=("src/step1/first.kt" "")
#执行文件名
sourceClassNames=("step1.first" "")
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
#限制每个shell连接所能写文件的最大容量100M
echo \'ulimit -f 10000\' >>/root/.bashrc ; source /root/.bashrc
compile(){
compileCommand="kotlinc -include-runtime -d mainfun.jar"
#取当前关卡的编译文件
challengeProgramName=${challengeProgramNames[$1 - 1]}
#当前关卡,作为参数传进来
challengeStage=$1
#删除上一次编译生成的文件,防止对本次编译造成影响
rm -f ./target/step$challengeStage/*.class &> /dev/null
# 获取编译结果(此处编译无输出则说明编译通过,否则输出编译错误信息,请按实训实际情况调整)
compileResult=$($compileCommand $challengeProgramName 2>&1 | base64)
if [ -z "$compileResult" ]; then
compileResult=$(echo -n "compile successfully" | base64)
fi
}
compile $1
execute(){
#执行命令
executeCommand="java -jar mainfun.jar"
#执行文件名
sourceClassName=${sourceClassNames[$1 - 1]}
challengeStage=$1
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
#执行,并拼接执行结果
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
#拼接输出结果
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
#return result in json format
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output}"
echo $result
}
#拼装成最终的json格式echo输出得到最后结果
returnResult
',100000,1024,1,120,1,2,null),
(19,'2de19c574588','elixir-ssh:v1.0','1','elixir1.5.3ssh
',1,'2018-01-29 11:31:25','2019-06-25 14:13:29','Elixir',null,100000,1024,1,120,0,2,null),
(20,'a0067972d5d8','android:v1.0','1','jdk7jdk8android-sdk',1,'2018-01-29 11:31:25','2019-07-31 10:18:28','Android','#!/bin/bash
#工作空间
cd WORKSPACE
#用户打开的文件名,之所以传过来这个,是因为可以从这个里面提取出来执行文件名
challengeProgramNames=("step1/makefile.py" "" "")
#执行文件名
sourceClassNames=("makefile" "" "")
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
#不需要编译,设定编译结果为成功编译
compileResult=$(echo -n "compile successfully" | base64)
#限制每个shell连接所能写文件的最大容量100M
echo \'ulimit -f 10000\' >>/root/.bashrc ; source /root/.bashrc
execute(){
#执行命令
executeCommand="python makefile.py"
#执行文件名
sourceClassName=${sourceClassNames[$1 - 1]}
challengeStage=$1
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
#执行,并拼接执行结果
cd step$1
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand 2>&1 | base64)
#拼接输出结果
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
#return result in json format
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output}"
echo "$result"
}
#拼装成最终的json格式echo输出得到最后结果
returnResult
',100000,1024,1,120,0,3,5),
(21,'21bf72b5e23e','ubuntu16-xfce-vnc:v1.0','0','VNC图形化镜像',1,'2018-01-29 11:31:25','2019-06-25 14:16:51','VNC',null,100000,1024,1,120,0,6,17),
(22,'1ec8ba103f82','jfinal-mysql55:v1.0','1','tomcat8.5.20mysql5.5jdk1.8ant1.10.1maven3.5.4',1,'2018-01-29 11:31:25','2019-06-25 14:15:30','JavaWeb','#!/bin/bash
cd WORKSPACEjfinalshop
sourceClassNames=("com.jfinalshop.test.TestRunner1" "com.jfinalshop.test.TestRunner2" "com.jfinalshop.test.TestRunner3" "com.jfinalshop.test.TestRunner4" "com.jfinalshop.test.TestRunner5" "com.jfinalshop.test.TestRunner6" "com.jfinalshop.test.TestRunner7")
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
echo \'ulimit -f 1000000\' >>/root/.bashrc ; source /root/.bashrc
restartTomcat(){
bash /home/apache-tomcat-8.5.20/bin/shutdown.sh &> /dev/null
bash /home/apache-tomcat-8.5.20/bin/startup.sh &> /dev/null
while :;
do
sleep 1
cat /home/apache-tomcat-8.5.20/logs/catalina.out| tail -20 | grep \'startup in\' &> /dev/null
if [ $? -eq 0 ]
then
break
fi
done
}
compile(){
compileCommand="ant -q -S"
compileResult=$($compileCommand 2>&1)
failedInfo="BUILD FAILED"
if [[ $compileResult == *$failedInfo* ]]; then
compileResult=$(echo -n $compileResult | base64)
else
compileResult=$(echo -n "compile successfully" | base64)
restartTomcat
fi
}
compile $1
execute(){
executeCommand="java -Dfile.encoding=UTF-8 -Djava.ext.dirs=../../WebRoot/WEB-INF/lib "
sourceClassName=${sourceClassNames[$1 - 1]}
challengeStage=$1
#get the loop times(looptimes = the num of testdataset)
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
#执行,并拼接执行结果
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
#拼接输出结果
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
#return result in json format
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output}"
echo $result
}
#拼装成最终的json格式echo输出得到最后结果
returnResult
',100000,1024,1,180,0,1,2),
(24,'833b45fe4ce5','go-ssh:v1.0','1','go1.9.2ssh',1,'2018-01-29 11:31:25','2019-06-25 14:13:41','Go','#!/bin/bash
cd WORKSPACE
#前台传来的可执行文件,即测试文件
sourceClassNames=("step1/devide.go" "step2/panic-recover.go" "step3/defertest.go")
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
#不需要编译,设定编译结果为成功编译
compileResult=$(echo -n "compile successfully" | base64)
echo \'ulimit -f 10000\' >>/root/.bashrc ; source /root/.bashrc
execute(){
executeCommand="go run "
sourceClassName=${sourceClassNames[$1 - 1]}
challengeStage=$1
#get the loop times(looptimes = the num of testdataset)
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
#执行,并拼接执行结果
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
#拼接输出结果
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
#return result in json format
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output}"
echo $result
}
#拼装成最终的json格式echo输出得到最后结果
returnResult
',100000,1024,1,120,0,2,null),
(27,'7a7980335112','mysql55-ssh:v1.0','0','mysql5.5ssh',1,'2018-01-29 11:31:25','2019-07-06 09:31:51','Mysql',null,100000,1024,1,120,0,4,9),
(29,'d3d83a78ed87','spark-ssh:v1.0','1','jdk8maven3.5.0ssh;',1,'2018-01-29 11:31:25','2019-07-25 19:31:54','Spark',null,100000,2048,1,180,0,5,14),
(30,'f0d5bfc8134e','machine-learning:v1.0','1','python2.7.9python3.6.2jdk8ssh',1,'2018-01-29 11:31:25','2019-06-25 14:15:37','MachineLearning','#!/bin/bash
cd WORKSPACE
#前台传来的可执行文件,即测试文件
sourceClassNames=(SOURCECLASSNAMES)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
echo \'ulimit -f 10000\' >>/root/.bashrc ; source /root/.bashrc
#不需要编译,设定编译结果为成功编译
compileResult=$(echo -n "compile successfully" | base64)
execute(){
executeCommand="python "
sourceClassName=${sourceClassNames[$1 - 1]}
challengeStage=$1
#get the loop times(looptimes = the num of testdataset)
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
#执行,并拼接执行结果
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
#拼接输出结果
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
#return result in json format
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output}"
echo $result
}
#拼装成最终的json格式echo输出得到最后结果
returnResult
',100000,1024,1,180,0,5,12),
(32,'c3f1760586db','iverilog-ssh:v1.0','1','verilog0.10.0ssh',1,'2018-01-29 11:31:25','2019-06-25 14:19:03','Verilog','#!/bin/bash
cd WORKSPACE
challengeProgramNames=("" "")
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
echo \'ulimit -f 1000000\' >>/root/.bashrc ; source /root/.bashrc
compile(){
compileCommand="iverilog "
challengeProgramName=${challengeProgramNames[$1 - 1]}
#remove the executeFile.out file that last time remains
rm -f ./executeFile.out &> /dev/null
# 获取编译结果(此处编译无输出则说明编译通过,否则输出编译错误信息,请按实训实际情况调整)
compileResult=$($compileCommand $challengeProgramName -o executeFile.out 2>&1 | base64)
if [ -z "$compileResult" ]; then
compileResult=$(echo -n "compile successfully" | base64)
fi
}
compile $1
execute(){
executeCommand="vvp "
challengeStage=$1
#get the loop times(looptimes = the num of testdataset)
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
#执行,并拼接执行结果
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand executeFile.out 2>&1 | base64)
#拼接输出结果
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
#return result in json format
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output}"
echo $result
}
#拼装成最终的json格式echo输出得到最后结果
returnResult
',100000,1024,1,120,1,8,19),
(34,'14a2cc7affa2','dind-ssh:v1.0','1','docker17.06.0-cessh',1,'2018-01-29 11:31:25','2019-06-25 14:13:21','Docker','#!/bin/bash
cd WORKSPACE
#前台传来的可执行文件,即测试文件
sourceClassNames=("")
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
#不需要编译,设定编译结果为成功编译
compileResult=$(echo -n "compile successfully" | base64)
echo \'ulimit -f 10000\' >>/root/.bashrc ; source /root/.bashrc
execute(){
executeCommand="bash "
sourceClassName=${sourceClassNames[$1 - 1]}
challengeStage=$1
#get the loop times(looptimes = the num of testdataset)
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
#执行,并拼接执行结果
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
#拼接输出结果
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
#return result in json format
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output}"
echo $result
}
#拼装成最终的json格式echo输出得到最后结果
returnResult
',100000,1024,1,120,0,5,13),
(35,null,null,'0','',1,'2018-01-29 15:15:33','2018-01-29 15:16:03','Html',null,100000,1024,1,120,0,1,1),
(36,null,null,'0','',1,'2018-01-29 15:15:45','2018-01-29 15:15:45','Web',null,100000,1024,1,120,0,1,2),
(39,'405aebc1e662','mono-ssh:v1.0','1','mono5.4.1.7ssh',1,'2018-01-29 16:11:33','2019-07-31 10:18:39','C#',null,100000,1024,1,120,1,2,null),
(64,'d9c6e8954dad','sqlite-ssh:v1.0','1','sqlite3.11.0ssh',1,'2018-03-06 14:03:48','2019-06-25 14:18:45','SQLite3',null,100000,1024,1,120,null,null,null),
(66,'fbaeac72b706','oracle-ssh:v1.0','1','oracle11.2.0.2.0ssh',1,'2018-03-29 15:18:41','2019-06-25 14:16:16','Oracle',null,100000,800,1,240,null,null,null),
(94,'1ed037bbd23f','ghdl-ssh:v1.0','1','ghdl-0.36-devgnat-5.4.0ssh',1,'2018-04-04 17:21:04','2019-06-25 14:19:07','Vhdl',null,100000,1024,1,120,null,null,null),
(95,'46198ab247fb','r-ssh:v1.0','1','R-3.4.4ssh',1,'2018-04-08 10:30:37','2019-06-25 14:18:29','R',null,100000,1024,1,120,null,null,null),
(96,'ea8282136791','swift-ssh:v1.0','1','swift-4.1ssh',1,'2018-04-09 15:13:06','2019-06-25 14:18:56','Swift',null,100000,1024,1,120,null,null,null),
(97,'5d4e4884482c','sqlserver-ssh:v1.0','1','sqlserver2017ssh',1,'2018-04-26 11:55:21','2019-06-25 14:18:50','SQLServer',null,100000,2000,1,120,null,null,null),
(98,'714ba67fe884','mysqlserver55-ssh:v1.0','1','mysql5.5ssh',1,'2018-05-10 09:40:08','2019-07-06 10:32:08','MySQL',null,100000,1024,1,120,null,null,null),
(102,'cf662ab7da9c','ubuntu16-install-ssh:v1.0','1','添加了hadoop3.1.0和jdk1.8的源码包;',1,'2018-06-15 16:49:29','2019-06-25 14:19:00','Ubuntu16-env',null,100000,2560,1,120,null,null,null),
(104,'24b3af129b64','mongo-ssh:v1.0','1','mogo4.0python3ssh',1,'2018-08-02 15:31:23','2019-06-25 14:15:59','Mongo',null,100000,1024,1,120,null,null,null),
(105,'3614e492d7e9','mongodb-ssh:v1.0','0','mogo4.0python3ssh',1,'2018-08-20 15:39:41','2019-06-25 14:16:44','Mogodb',null,100000,1024,1,120,null,null,null),
(106,'01ed95c29336','python3-vnc:v1.0','1','turtle库python3.5vnc',1,'2018-09-06 11:32:52','2019-06-25 14:17:37','Python3-vnc',null,100000,1024,1,120,null,null,null),
(107,'84499af0600f','python3-competition:v1.0','1','没有安装sklearn包',1,'2018-10-29 10:23:30','2019-06-25 14:17:29','Python3-competition',null,100000,1024,1,120,null,null,null),
(108,'b64b94a5ed4d','hbase-ssh:v1.0','1','Hadoop2.7 JDK8.0 HBase2.1.1 伪分布式',1,'2018-11-14 13:16:45','2019-06-25 14:14:35','Hbase',null,100000,3096,2,200,null,null,null),
(109,'f890a121e481','postgresql-ssh:v1.0','1','postgresql9.5.14ssh',1,'2018-11-15 12:15:17','2019-06-25 14:16:32','PostgreSql',null,100000,1024,1,120,null,null,null),
(110,'bd62c3d558cd','hbase2-ssh:v1.0','1','为分部署定制的镜像。',1,'2018-11-18 15:27:27','2019-06-25 14:15:13','Hbase2',null,100000,4048,1,120,null,null,null),
(111,'8bfdbbac7601','hbase-simple:v1.0','1','单节点',1,'2018-11-30 15:10:54','2019-08-06 17:03:27','Hbase-simple',null,100000,3072,2,80,null,null,null),
(112,'b1b1eb1ad716','sqoop-ssh:v1.0','1','Hbase基础上安装了 sqoop',1,'2018-12-18 09:21:54','2019-06-25 14:18:53','Sqoop',null,100000,2048,1,120,null,null,null),
(113,null,null,'0','',1,'2018-12-20 10:20:33','2018-12-20 10:20:33','Css',null,100000,1024,1,120,null,null,null),
(114,'433f4526ec22','nasm-ssh:v1.0','1','汇编语言',1,'2019-02-18 17:13:34','2019-06-25 14:16:13','Nasm',null,100000,1024,1,120,null,null,null),
(115,'06144b287844','ubuntu-nvidia:v1.0','1','GPU',1,'2019-03-07 14:32:45','2019-06-25 14:16:35','Python-Gpu',null,100000,2048,1,120,null,null,null),
(116,'90366fe59219','python3-tentensorflow1.5-ssh:v1.0','1','',1,'2019-03-08 10:48:22','2019-06-25 14:17:33','Python3-tentensorflow1.5',null,100000,2048,1,120,null,null,null),
(118,'18f7eeb2d1c2','kafka-ssh:v1.0','1','kafka_2.11-1.1.0afka_2.11-1.1.0sshmvn',1,'2019-03-20 17:33:46','2019-08-02 15:02:46','Kafka',null,100000,2500,1,120,null,null,null),
(119,'b3f6ce4aafbb','vscode-novnc:v1.0','1','VSCode、novnc、netsurf、ssh、pip3、flask、sogou;',1,'2019-05-29 17:42:02','2019-07-25 16:19:42','VSCode',null,100000,2048,1,120,null,null,null),
(120,'64f5d945efcc','ubuntu-nvidia-c:v1.0','1','cuda、mpi',1,'2019-06-05 17:46:20','2019-06-25 14:13:45','GPU-C/C++',null,100000,1024,1,120,null,null,null),
(123,'c4f0b2ef2ed2','flink-mysql55:v1.0','1','flink1.8、mvn、jdk8;',1,'2019-06-17 16:10:27','2019-07-19 13:28:00','Flink',null,100000,2560,1,120,null,null,null),
(124,'bdfb097d9a30','matlab-novnc:v1.0','1','matlab2017图形化',1,'2019-06-25 13:29:14','2019-06-27 16:26:55','Matlab/vnc',null,100000,2048,2,120,null,null,null),
(126,'12450a0d48ea','sqlserver-ssh2:v1.0',null,null,0,'2019-06-26 10:23:18','2019-06-26 10:23:18',null,null,100000,1024,1,120,null,null,null),
(127,'16e3a8b20df2','cisco-novnc:v1.0','1','cisco、vscode、firefox、wireshark',1,'2019-07-17 17:03:53','2019-07-17 17:06:12','Cisco',null,100000,1024,1,120,null,null,null);
DROP TABLE IF EXISTS `mirror_scripts`;
CREATE TABLE `mirror_scripts` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`mirror_repository_id` int(11) DEFAULT NULL,
`script` longtext,
`script_type` varchar(255) DEFAULT NULL,
`description` text,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=88 DEFAULT CHARSET=utf8;
insert into `mirror_scripts`(`id`,`mirror_repository_id`,`script`,`script_type`,`description`,`created_at`,`updated_at`) values
(1,13,'#!/bin/bash
cd WORKSPACE
challengeProgramNames=(CHALLENGEPROGRAMNAMES)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
echo \'ulimit -f 1000000\' >>/root/.bashrc ; source /root/.bashrc
compile(){
compileCommand="gcc -lm -lc -lz "
challengeProgramName=${challengeProgramNames[$1 - 1]}
#remove the executeFile.out file that last time remains
rm -f ./executeFile.out &> /dev/null
#compile all .c file in the source folder: a/b/c.c --> a/b/*.c
challengeProgramName=${challengeProgramName%/*.c}"/*.c"
# 获取编译结果(此处编译无输出则说明编译通过,否则输出编译错误信息,请按实训实际情况调整)
compileResult=$($compileCommand $challengeProgramName -o executeFile.out 2>&1 | base64)
if [ -z "$compileResult" ]; then
compileResult=$(echo -n "compile successfully" | base64)
fi
}
compile $1
execute(){
executeCommand="./executeFile.out"
challengeStage=$1
#get the loop times(looptimes = the num of testdataset)
res_usage="{\\"testSetUsages\\":["
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes
startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
#执行,并拼接执行结果
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand | base64)
#拼接输出结果
endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
let testSetCpuUsage=$endCpuUsage-$startCpuUsage
maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)
res_usage="$res_usage{\\"testSetTime\\":\\"$testSetCpuUsage\\",\\"testSetMem\\":\\"$maxMemUsage\\"},"
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
res_usage="${res_usage::-1}"
res_usage="$res_usage]}"
res_usage=$(echo -ne "$res_usage"|base64)
#return result in json format
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output,\\"resUsage\\":\\"$res_usage\\"}"
echo $result
}
#拼装成最终的json格式echo输出得到最后结果
returnResult
','C','C标准脚本','2018-01-29 14:43:15','2019-07-19 13:53:37'),
(2,13,'#!/bin/bash
cd WORKSPACE
challengeProgramNames=(CHALLENGEPROGRAMNAMES)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
echo \'ulimit -f 1000000\' >>/root/.bashrc ; source /root/.bashrc
compile(){
compileCommand="g++ "
challengeProgramName=${challengeProgramNames[$1 - 1]}
#remove the executeFile.out file that last time remains
rm -f ./executeFile.out &> /dev/null
#compile all .c file in the source folder: a/b/c.cpp --> a/b/*.cpp
challengeProgramName=${challengeProgramName%/*.cpp}"/*.cpp"
# 获取编译结果(此处编译无输出则说明编译通过,否则输出编译错误信息,请按实训实际情况调整)
compileResult=$($compileCommand $challengeProgramName -o executeFile.out 2>&1 | base64)
if [ -z "$compileResult" ]; then
compileResult=$(echo -n "compile successfully" | base64)
fi
}
compile $1
execute(){
executeCommand="./executeFile.out"
challengeStage=$1
#get the loop times(looptimes = the num of testdataset)
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
#执行,并拼接执行结果
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand | base64)
#拼接输出结果
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
#return result in json format
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output}"
echo $result
}
#拼装成最终的json格式echo输出得到最后结果
returnResult
','C++','C++标准脚本','2018-01-29 14:43:33','2018-01-29 14:43:33'),
(3,20,'#!/bin/bash
cd WORKSPACE
# 待执行的评测文件
sourceClassNames=(SOURCECLASSNAMES)
# 执行命令
executeCommand="python"
# 获取测试用例的输入(请勿改动此行语句)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
compileResult=$(echo -n "compile successfully" | base64)
# 执行函数
execute(){
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环获取各测试用例下的实际输出
res_usage="{\\"testSetUsages\\":["
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes
startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
# 拼接输出结果
endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
let testSetCpuUsage=$endCpuUsage-$startCpuUsage
maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)
res_usage="$res_usage{\\"testSetTime\\":\\"$testSetCpuUsage\\",\\"testSetMem\\":\\"$maxMemUsage\\"},"
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
res_usage="${res_usage::-1}"
res_usage="$res_usage]}"
res_usage=$(echo -ne "$res_usage"|base64)
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output,\\"resUsage\\":\\"$res_usage\\"}"
echo $result
}
returnResult','Android','Android默认脚本','2018-01-29 14:45:55','2019-07-19 13:52:03'),
(4,34,'#!/bin/bash
cd WORKSPACE
# 待执行的评测文件
sourceClassNames=(SOURCECLASSNAMES)
# 执行命令
executeCommand="bash"
# 获取测试用例的输入(请勿改动此行语句)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
compileResult=$(echo -n "compile successfully" | base64)
# 执行函数
execute(){
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环获取各测试用例下的实际输出
res_usage="{\\"testSetUsages\\":["
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes
startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
# 拼接输出结果
endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
let testSetCpuUsage=$endCpuUsage-$startCpuUsage
maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)
res_usage="$res_usage{\\"testSetTime\\":\\"$testSetCpuUsage\\",\\"testSetMem\\":\\"$maxMemUsage\\"},"
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
res_usage="${res_usage::-1}"
res_usage="$res_usage]}"
res_usage=$(echo -ne "$res_usage"|base64)
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output,\\"resUsage\\":\\"$res_usage\\"}"
echo $result
}
returnResult','Docker','Docker标准脚本','2018-01-29 14:57:28','2019-07-19 11:23:54'),
(5,3,'#!/bin/bash
cd WORKSPACE
# 待执行的评测文件
sourceClassNames=(SOURCECLASSNAMES)
# 执行命令
executeCommand="bash"
# 获取测试用例的输入(请勿改动此行语句)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
compileResult=$(echo -n "compile successfully" | base64)
# 执行函数
execute(){
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环获取各测试用例下的实际输出
res_usage="{\\"testSetUsages\\":["
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes
startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
# 拼接输出结果
endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
let testSetCpuUsage=$endCpuUsage-$startCpuUsage
maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)
res_usage="$res_usage{\\"testSetTime\\":\\"$testSetCpuUsage\\",\\"testSetMem\\":\\"$maxMemUsage\\"},"
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
res_usage="${res_usage::-1}"
res_usage="$res_usage]}"
res_usage=$(echo -ne "$res_usage"|base64)
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output,\\"resUsage\\":\\"$res_usage\\"}"
echo $result
}
returnResult','Dynamips','Dynamips标准脚本','2018-01-29 14:58:29','2019-07-19 11:25:27'),
(6,19,'#!/bin/bash
cd WORKSPACE
# 待执行的评测文件
sourceClassNames=(SOURCECLASSNAMES)
# 执行命令
executeCommand="elixir"
# 获取测试用例的输入(请勿改动此行语句)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
compileResult=$(echo -n "compile successfully" | base64)
# 执行函数
execute(){
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环获取各测试用例下的实际输出
res_usage="{\\"testSetUsages\\":["
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes
startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
# 拼接输出结果
endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
let testSetCpuUsage=$endCpuUsage-$startCpuUsage
maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)
res_usage="$res_usage{\\"testSetTime\\":\\"$testSetCpuUsage\\",\\"testSetMem\\":\\"$maxMemUsage\\"},"
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
res_usage="${res_usage::-1}"
res_usage="$res_usage]}"
res_usage=$(echo -ne "$res_usage"|base64)
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output,\\"resUsage\\":\\"$res_usage\\"}"
echo $result
}
returnResult','Elixir','Elixir标准脚本','2018-01-29 14:59:17','2019-07-19 11:27:24'),
(7,12,'#!/bin/bash
cd WORKSPACE
# 待执行的评测文件
sourceClassNames=(SOURCECLASSNAMES)
# 执行命令
executeCommand="python"
# 获取测试用例的输入(请勿改动此行语句)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
compileResult=$(echo -n "compile successfully" | base64)
# 执行函数
execute(){
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环获取各测试用例下的实际输出
res_usage="{\\"testSetUsages\\":["
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes
startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
# 拼接输出结果
endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
let testSetCpuUsage=$endCpuUsage-$startCpuUsage
maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)
res_usage="$res_usage{\\"testSetTime\\":\\"$testSetCpuUsage\\",\\"testSetMem\\":\\"$maxMemUsage\\"},"
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
res_usage="${res_usage::-1}"
res_usage="$res_usage]}"
res_usage=$(echo -ne "$res_usage"|base64)
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output,\\"resUsage\\":\\"$res_usage\\"}"
echo $result
}
returnResult','Git','Git标准脚本','2018-01-29 14:59:50','2019-07-19 11:31:34'),
(8,24,'#!/bin/bash
cd WORKSPACE
# 待执行的评测文件
sourceClassNames=(SOURCECLASSNAMES)
# 执行命令
executeCommand="go run"
# 获取测试用例的输入(请勿改动此行语句)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
compileResult=$(echo -n "compile successfully" | base64)
# 执行函数
execute(){
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环获取各测试用例下的实际输出
res_usage="{\\"testSetUsages\\":["
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes
startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
# 拼接输出结果
endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
let testSetCpuUsage=$endCpuUsage-$startCpuUsage
maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)
res_usage="$res_usage{\\"testSetTime\\":\\"$testSetCpuUsage\\",\\"testSetMem\\":\\"$maxMemUsage\\"},"
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
res_usage="${res_usage::-1}"
res_usage="$res_usage]}"
res_usage=$(echo -ne "$res_usage"|base64)
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output,\\"resUsage\\":\\"$res_usage\\"}"
echo $result
}
returnResult','Go','Go标准脚本','2018-01-29 15:00:35','2019-07-19 11:33:07'),
(9,7,'#!/bin/bash
cd WORKSPACE
# 待编译的评测文件
challengeProgramNames=(CHALLENGEPROGRAMNAMES)
# 待执行的评测文件
sourceClassNames=(SOURCECLASSNAMES)
# 获取测试用例的输入(请勿改动此行语句)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
# 编译函数
compile(){
cd step$1
# 编译命令
compileCommand="/apache-ant-1.10.1/bin/ant -q -S"
# 取当前关卡的编译文件
challengeProgramName=${challengeProgramNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
############################################
compileResult=$($compileCommand 2>&1)
echo $compileResult |grep \'BUILD FAILED\' >/dev/null
if [[ $? == 0 ]]; then
compileResult=$(echo -n $compileResult | base64)
else
compileResult=$(echo -n "compile successfully" | base64)
fi
}
compile $1
execute(){
# 执行命令
executeCommand="sh $1.sh"
# 执行文件名
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环获取各测试用例下的实际输出
res_usage="{\\"testSetUsages\\":["
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes
startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
# 拼接输出结果
endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
let testSetCpuUsage=$endCpuUsage-$startCpuUsage
maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)
res_usage="$res_usage{\\"testSetTime\\":\\"$testSetCpuUsage\\",\\"testSetMem\\":\\"$maxMemUsage\\"},"
output=$output\\"$(cat /tmp/output/part-r-00000 2>/dev/null | base64)\\",
let i++
done
output="[${output%?}]"
}
execute $1
res_usage="${res_usage::-1}"
res_usage="$res_usage]}"
res_usage=$(echo -ne "$res_usage"|base64)
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output,\\"resUsage\\":\\"$res_usage\\"}"
echo $result
}
returnResult
','Hadoop','Hadoop标准脚本','2018-01-29 15:01:06','2019-07-19 11:38:37'),
(10,6,'#!/bin/bash
cd WORKSPACE
# 待执行的评测文件
sourceClassNames=(SOURCECLASSNAMES)
# 执行命令
executeCommand="bash"
# 获取测试用例的输入(请勿改动此行语句)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
compileResult=$(echo -n "compile successfully" | base64)
# 执行函数
execute(){
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环获取各测试用例下的实际输出
res_usage="{\\"testSetUsages\\":["
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes
startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
# 拼接输出结果
endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
let testSetCpuUsage=$endCpuUsage-$startCpuUsage
maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)
res_usage="$res_usage{\\"testSetTime\\":\\"$testSetCpuUsage\\",\\"testSetMem\\":\\"$maxMemUsage\\"},"
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
res_usage="${res_usage::-1}"
res_usage="$res_usage]}"
res_usage=$(echo -ne "$res_usage"|base64)
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output,\\"resUsage\\":\\"$res_usage\\"}"
echo $result
}
returnResult','hive-shell','','2018-01-29 15:01:39','2019-07-19 14:14:41'),
(11,5,'#!/bin/bash
cd WORKSPACE
# 待编译的评测文件
challengeProgramNames=(CHALLENGEPROGRAMNAMES)
# 待执行的评测文件(可能是编译所得的可执行文件,请按实际情况填写)
sourceClassNames=(SOURCECLASSNAMES)
# 编译命令
compileCommand="javac -encoding UTF-8 -Djava.ext.dirs=./lib/ -sourcepath src/ -d target/"
# 执行命令
executeCommand="java -Dfile.encoding=UTF-8 -Djava.ext.dirs=./lib/ -cp target/"
# 获取测试用例的输入(请勿改动此行语句)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
# 限制每个shell连接所能写文件的最大容量
echo \'ulimit -f 10000\' >>/root/.bashrc ; source /root/.bashrc
# 编译函数
compile(){
# 创建target目录
mkdir target &> /dev/null
# 删除上一次编译生成的文件,防止对本次编译造成影响
rm -rf ./target/** &> /dev/null
# 当前关卡的编译目标文件
challengeProgramName=${challengeProgramNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 获取编译结果(此处编译无输出则说明编译通过,否则输出编译错误信息,请按实训实际情况调整)
compileResult=$($compileCommand $challengeProgramName 2>&1 | base64)
if [ -z "$compileResult" ]; then
compileResult=$(echo -n "compile successfully" | base64)
fi
}
compile $1
# 执行函数
execute(){
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环获取各测试用例下的实际输出
res_usage="{\\"testSetUsages\\":["
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes
startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
# 拼接执行结果
endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
let testSetCpuUsage=$endCpuUsage-$startCpuUsage
maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)
res_usage="$res_usage{\\"testSetTime\\":\\"$testSetCpuUsage\\",\\"testSetMem\\":\\"$maxMemUsage\\"},"
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
res_usage="${res_usage::-1}"
res_usage="$res_usage]}"
res_usage=$(echo -ne "$res_usage"|base64)
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output,\\"resUsage\\":\\"$res_usage\\"}"
echo $result
}
returnResult
','Java','Java默认脚本','2018-01-29 15:02:23','2019-07-19 14:16:22'),
(12,16,'#!/bin/bash
cd WORKSPACE
# 待执行的评测文件
sourceClassNames=(SOURCECLASSNAMES)
# 执行命令
executeCommand="node"
# 获取测试用例的输入(请勿改动此行语句)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
compileResult=$(echo -n "compile successfully" | base64)
# 执行函数
execute(){
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环获取各测试用例下的实际输出
res_usage="{\\"testSetUsages\\":["
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes
startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
# 拼接输出结果
endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
let testSetCpuUsage=$endCpuUsage-$startCpuUsage
maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)
res_usage="$res_usage{\\"testSetTime\\":\\"$testSetCpuUsage\\",\\"testSetMem\\":\\"$maxMemUsage\\"},"
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
res_usage="${res_usage::-1}"
res_usage="$res_usage]}"
res_usage=$(echo -ne "$res_usage"|base64)
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output,\\"resUsage\\":\\"$res_usage\\"}"
echo $result
}
returnResult','JavaScript','JavaScript标准脚本','2018-01-29 15:03:04','2019-07-19 14:18:41'),
(13,22,'#!/bin/bash
#tomcat路径:/home/apache-tomcat-8.5.20/
cd WORKSPACEjfinalshop
sourceClassNames=(SOURCECLASSNAMES)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
echo \'ulimit -f 1000000\' >>/root/.bashrc ; source /root/.bashrc
restartTomcat(){
bash /home/apache-tomcat-8.5.20/bin/shutdown.sh &> /dev/null
bash /home/apache-tomcat-8.5.20/bin/startup.sh &> /dev/null
while :;
do
sleep 1
cat /home/apache-tomcat-8.5.20/logs/catalina.out| tail -20 | grep \'startup in\' &> /dev/null
if [ $? -eq 0 ]
then
break
fi
done
}
compile(){
compileCommand="ant -q -S"
compileResult=$($compileCommand 2>&1)
failedInfo="BUILD FAILED"
if [[ $compileResult == *$failedInfo* ]]; then
compileResult=$(echo -n $compileResult | base64)
else
compileResult=$(echo -n "compile successfully" | base64)
restartTomcat
fi
}
compile $1
execute(){
executeCommand="java -Dfile.encoding=UTF-8 -Djava.ext.dirs=../../WebRoot/WEB-INF/lib "
sourceClassName=${sourceClassNames[$1 - 1]}
challengeStage=$1
# 切换到编译文件的目录
cd build/classes
res_usage="{\\"testSetUsages\\":["
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes
startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
#执行,并拼接执行结果
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
#拼接输出结果
endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
let testSetCpuUsage=$endCpuUsage-$startCpuUsage
maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)
res_usage="$res_usage{\\"testSetTime\\":\\"$testSetCpuUsage\\",\\"testSetMem\\":\\"$maxMemUsage\\"},"
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
res_usage="${res_usage::-1}"
res_usage="$res_usage]}"
res_usage=$(echo -ne "$res_usage"|base64)
#return result in json format
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output,\\"resUsage\\":\\"$res_usage\\"}"
echo $result
}
#拼装成最终的json格式echo输出得到最后结果
returnResult
','JFinal','JFinal标准脚本','2018-01-29 15:03:43','2019-07-19 14:22:22'),
(14,18,'#!/bin/bash
cd WORKSPACE
# 待编译的评测文件
challengeProgramNames=(CHALLENGEPROGRAMNAMES)
# 待执行的评测文件
sourceClassNames=(SOURCECLASSNAMES)
# 编译命令
compileCommand="kotlinc -include-runtime -d mainfun.jar"
# 执行命令
executeCommand="java -jar mainfun.jar"
# 获取测试用例的输入(请勿改动此行语句)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
# 编译函数
compile(){
# 当前关卡的编译目标文件
challengeProgramName=${challengeProgramNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 删除上一次编译生成的文件,防止对本次编译造成影响
rm -rf *.jar &> /dev/null
rm -rf ./target/** &> /dev/null
# 获取编译结果(此处编译无输出则说明编译通过,否则输出编译错误信息,请按实训实际情况调整)
compileResult=$($compileCommand $challengeProgramName 2>&1 | base64)
if [ -z "$compileResult" ]; then
compileResult=$(echo -n "compile successfully" | base64)
fi
}
compile $1
# 执行函数
execute(){
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环获取各测试用例下的实际输出
res_usage="{\\"testSetUsages\\":["
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes
startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
# 拼接输出结果
endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
let testSetCpuUsage=$endCpuUsage-$startCpuUsage
maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)
res_usage="$res_usage{\\"testSetTime\\":\\"$testSetCpuUsage\\",\\"testSetMem\\":\\"$maxMemUsage\\"},"
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
res_usage="${res_usage::-1}"
res_usage="$res_usage]}"
res_usage=$(echo -ne "$res_usage"|base64)
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output,\\"resUsage\\":\\"$res_usage\\"}"
echo $result
}
returnResult
','Kotlin','Kotlin标准脚本','2018-01-29 15:04:13','2019-07-19 14:26:51'),
(15,30,'#!/bin/bash
cd WORKSPACE
# 待执行的评测文件
sourceClassNames=(SOURCECLASSNAMES)
# 执行命令
executeCommand="python"
# 获取测试用例的输入(请勿改动此行语句)
input=$2; OLD_IFS="$IFS"; IFS=,; ins=($input); IFS="$OLD_IFS"
compileResult=$(echo -n "compile successfully" | base64)
# 执行函数
execute(){
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环获取各测试用例下的实际输出
res_usage="{\\"testSetUsages\\":["
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes
startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
#拼接输出结果
endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
let testSetCpuUsage=$endCpuUsage-$startCpuUsage
maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)
res_usage="$res_usage{\\"testSetTime\\":\\"$testSetCpuUsage\\",\\"testSetMem\\":\\"$maxMemUsage\\"},"
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
res_usage="${res_usage::-1}"
res_usage="$res_usage]}"
res_usage=$(echo -ne "$res_usage"|base64)
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output,\\"resUsage\\":\\"$res_usage\\"}"
echo $result
}
returnResult','MachineLearning','MachineLearning标准脚本','2018-01-29 15:04:49','2019-07-19 14:28:50'),
(16,10,'#!/bin/bash
cd WORKSPACE
# 待执行的评测文件
sourceClassNames=(SOURCECLASSNAMES)
# 执行命令
executeCommand="octave"
# 获取测试用例的输入(请勿改动此行语句)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
compileResult=$(echo -n "compile successfully" | base64)
# 执行函数
execute(){
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环获取各测试用例下的实际输出
res_usage="{\\"testSetUsages\\":["
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes
startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 |grep -vE "warning: function|octave: unable|octave: disabling" | base64)
# 拼接输出结果
endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
let testSetCpuUsage=$endCpuUsage-$startCpuUsage
maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)
res_usage="$res_usage{\\"testSetTime\\":\\"$testSetCpuUsage\\",\\"testSetMem\\":\\"$maxMemUsage\\"},"
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
res_usage="${res_usage::-1}"
res_usage="$res_usage]}"
res_usage=$(echo -ne "$res_usage"|base64)
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output,\\"resUsage\\":\\"$res_usage\\"}"
echo $result
}
returnResult','Matlab','Matlab标准脚本','2018-01-29 15:05:27','2019-07-19 14:30:10'),
(17,17,'#!/bin/bash
cd WORKSPACE
# 待执行的评测文件
sourceClassNames=(SOURCECLASSNAMES)
# 执行命令
executeCommand="perl6"
# 获取测试用例的输入(请勿改动此行语句)
input=$2; OLD_IFS="$IFS"; IFS=,; ins=($input); IFS="$OLD_IFS"
compileResult=$(echo -n "compile successfully" | base64)
# 执行函数
execute(){
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环获取各测试用例下的实际输出
res_usage="{\\"testSetUsages\\":["
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes
startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
# 拼接输出结果
endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
let testSetCpuUsage=$endCpuUsage-$startCpuUsage
maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)
res_usage="$res_usage{\\"testSetTime\\":\\"$testSetCpuUsage\\",\\"testSetMem\\":\\"$maxMemUsage\\"},"
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
res_usage="${res_usage::-1}"
res_usage="$res_usage]}"
res_usage=$(echo -ne "$res_usage"|base64)
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output,\\"resUsage\\":\\"$res_usage\\"}"
echo $result
}
returnResult','Perl6','Perl6标准脚本','2018-01-29 15:06:34','2019-07-19 15:00:31'),
(18,9,'#!/bin/bash
cd WORKSPACE
# 待执行的评测文件
sourceClassNames=(SOURCECLASSNAMES)
# 执行命令
executeCommand="php"
# 获取测试用例的输入(请勿改动此行语句)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
compileResult=$(echo -n "compile successfully" | base64)
# 执行函数
execute(){
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环获取各测试用例下的实际输出
res_usage="{\\"testSetUsages\\":["
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes
startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
# 拼接输出结果
endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
let testSetCpuUsage=$endCpuUsage-$startCpuUsage
maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)
res_usage="$res_usage{\\"testSetTime\\":\\"$testSetCpuUsage\\",\\"testSetMem\\":\\"$maxMemUsage\\"},"
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
res_usage="${res_usage::-1}"
res_usage="$res_usage]}"
res_usage=$(echo -ne "$res_usage"|base64)
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output,\\"resUsage\\":\\"$res_usage\\"}"
echo $result
}
returnResult','PHP','PHP标准脚本','2018-01-29 15:07:02','2019-07-19 15:03:08'),
(19,4,'#!/bin/bash
cd WORKSPACE
# 待执行的评测文件
sourceClassNames=(SOURCECLASSNAMES)
# 执行命令
executeCommand="python"
# 获取测试用例的输入(请勿改动此行语句)
input=$2; OLD_IFS="$IFS"; IFS=,; ins=($input); IFS="$OLD_IFS"
compileResult=$(echo -n "compile successfully" | base64)
# 执行函数
execute(){
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环获取各测试用例下的实际输出
res_usage="{\\"testSetUsages\\":["
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes
startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
#拼接输出结果
endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
let testSetCpuUsage=$endCpuUsage-$startCpuUsage
maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)
res_usage="$res_usage{\\"testSetTime\\":\\"$testSetCpuUsage\\",\\"testSetMem\\":\\"$maxMemUsage\\"},"
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
res_usage="${res_usage::-1}"
res_usage="$res_usage]}"
res_usage=$(echo -ne "$res_usage"|base64)
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output,\\"resUsage\\":\\"$res_usage\\"}"
echo $result
}
returnResult','Python2.7','Python2.7标准脚本','2018-01-29 15:09:20','2019-07-19 15:12:14'),
(20,2,'#!/bin/bash
cd WORKSPACE
# 待执行的评测文件
sourceClassNames=(SOURCECLASSNAMES)
# 执行命令
executeCommand="python"
# 获取测试用例的输入(请勿改动此行语句)
input=$2; OLD_IFS="$IFS"; IFS=,; ins=($input); IFS="$OLD_IFS"
compileResult=$(echo -n "compile successfully" | base64)
# 执行函数
execute(){
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环获取各测试用例下的实际输出
res_usage="{\\"testSetUsages\\":["
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes
startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
#拼接输出结果
endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
let testSetCpuUsage=$endCpuUsage-$startCpuUsage
maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)
res_usage="$res_usage{\\"testSetTime\\":\\"$testSetCpuUsage\\",\\"testSetMem\\":\\"$maxMemUsage\\"},"
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
res_usage="${res_usage::-1}"
res_usage="$res_usage]}"
res_usage=$(echo -ne "$res_usage"|base64)
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output,\\"resUsage\\":\\"$res_usage\\"}"
echo $result
}
returnResult','Python3.6','Python3.6标准脚本','2018-01-29 15:10:18','2019-07-19 15:22:37'),
(21,2,'#!/bin/bash
cd WORKSPACE
# 待执行的评测文件
sourceClassNames=(SOURCECLASSNAMES)
# 执行命令
executeCommand="python"
# 获取测试用例的输入(请勿改动此行语句)
input=$2; OLD_IFS="$IFS"; IFS=,; ins=($input); IFS="$OLD_IFS"
compileResult=$(echo -n "compile successfully" | base64)
# 执行函数
execute(){
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环检测数据库是否已启动
while :;
do
mysql -h127.0.0.1 -uroot -p123123 -e "show databases" 2>&1 >/dev/null
if [ $? -eq 0 ];then
break
else
sleep 1
fi
done
# 循环获取各测试用例下的实际输出
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
# 拼接输出结果
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output}"
echo $result
}
returnResult','Python3.6/Mysql','增加了等待mysql服务启动','2018-01-29 15:10:30','2018-01-31 11:17:22'),
(22,14,'#!/bin/bash
cd WORKSPACE
# 待执行的评测文件
sourceClassNames=(SOURCECLASSNAMES)
# 执行命令
executeCommand="ruby"
# 获取测试用例的输入(请勿改动此行语句)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
compileResult=$(echo -n "compile successfully" | base64)
# 执行函数
execute(){
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环获取各测试用例下的实际输出
res_usage="{\\"testSetUsages\\":["
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes
startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
# 拼接输出结果
endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
let testSetCpuUsage=$endCpuUsage-$startCpuUsage
maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)
res_usage="$res_usage{\\"testSetTime\\":\\"$testSetCpuUsage\\",\\"testSetMem\\":\\"$maxMemUsage\\"},"
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
res_usage="${res_usage::-1}"
res_usage="$res_usage]}"
res_usage=$(echo -ne "$res_usage"|base64)
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output,\\"resUsage\\":\\"$res_usage\\"}"
echo $result
}
returnResult','Ruby','Ruby标准脚本','2018-01-29 15:11:04','2019-07-19 15:26:36'),
(23,8,'#!/bin/bash
cd WORKSPACE
# 待编译的评测文件
challengeProgramNames=(CHALLENGEPROGRAMNAMES)
# 当前关卡的编译目标文件
challengeProgramName=${challengeProgramNames[$1 - 1]}
# 编译命令
compileCommand="gcc $challengeProgramName -lSDL2 -lSDL2_image -lSDL2_mixer"
# 执行命令
executeCommand="./a.out"
# 获取测试用例的输入(请勿改动此行语句)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
# 编译函数
compile(){
# 当前关卡号
challengeStage=$1
# 删除上一次编译生成的文件,防止对本次编译造成影响
rm -f ./target/step$challengeStage/*.class &> /dev/null
#compile 编译文件并将编译结果输出至compile_result_$challengeStage.out
$compileCommand > compile_result_$challengeStage.out 2>&1
#检测编译输出文件是否为空,编译成功的时候没有输出,有输出就说明编译失败。
#拿到编译结果并用base64编码
compileResult=\'\'
if test -s compile_result_$challengeStage.out; then
compileResult=$(cat compile_result_$challengeStage.out | base64)
else
compileResult=$(echo -n "compile successfully" | base64)
fi
}
compile $1
# 执行函数
execute(){
# 当前关卡号
challengeStage=$1
# 循环获取各测试用例下的实际输出
res_usage="{\\"testSetUsages\\":["
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes
startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand 2>&1 | base64)
# 拼接输出结果
endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
let testSetCpuUsage=$endCpuUsage-$startCpuUsage
maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)
res_usage="$res_usage{\\"testSetTime\\":\\"$testSetCpuUsage\\",\\"testSetMem\\":\\"$maxMemUsage\\"},"
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
res_usage="${res_usage::-1}"
res_usage="$res_usage]}"
res_usage=$(echo -ne "$res_usage"|base64)
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output,\\"resUsage\\":\\"$res_usage\\"}"
echo $result
}
returnResult','SDL','SDL标准脚本','2018-01-29 15:11:50','2019-07-19 15:28:33'),
(24,15,'#!/bin/bash
cd WORKSPACE
# 待执行的评测文件
sourceClassNames=(SOURCECLASSNAMES)
# 执行命令
executeCommand="bash"
# 获取测试用例的输入(请勿改动此行语句)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
compileResult=$(echo -n "compile successfully" | base64)
# 执行函数
execute(){
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环获取各测试用例下的实际输出
res_usage="{\\"testSetUsages\\":["
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes
startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
# 拼接输出结果
endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
let testSetCpuUsage=$endCpuUsage-$startCpuUsage
maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)
res_usage="$res_usage{\\"testSetTime\\":\\"$testSetCpuUsage\\",\\"testSetMem\\":\\"$maxMemUsage\\"},"
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
res_usage="${res_usage::-1}"
res_usage="$res_usage]}"
res_usage=$(echo -ne "$res_usage"|base64)
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output,\\"resUsage\\":\\"$res_usage\\"}"
echo $result
}
returnResult','Shell','','2018-01-29 15:12:29','2019-07-19 15:34:04'),
(25,29,'########
#有些命令会有不必要的输出要过滤掉grep -v或者直接去掉所有输出2>&1 >/dev/null
########
#进入版本库目录WORKSPACE平台会替换为版本库的绝对路径
cd WORKSPACE
#将spark实训程序所需输入文件放入/tmp/路径,程序再从/tmp/1.txt读取输入因为代码拿不到版本库输入文件的绝对路径
cp ./1.txt /tmp/ 2>&1 >/dev/null
#mvn编译时的路径
CompilePath=("第一关编译路径" "第二关编译路径" "第三关编译路径" "...")
#mvn编译命令
compileCommand="mvn package "
#spark执行的jar包的绝对路径WORKSPACE+当前路径=绝对路径)
ExecutePath=("WORKSPACE/step1/target/*.jar" "WORKSPACE/step2/target/*.jar" "WORKSPACE/step3/target/*.jar")
#执行命令
executeCommand="spark-submit --class $ClassName_Now $ExecutePath_Now"
#spark执行时的class名称
ClassName=("step1" "step2" "step3")
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
echo \'ulimit -f 1000000\' >>/root/.bashrc ; source /root/.bashrc
#编译函数
compile(){
#获取当前关卡的编译路径
CompilePath_Now=${CompilePath[$1 - 1]}
#进入编译目录
cd $CompilePath_Now
#清除历史jar包
rm -f ./target/*.jar 2>&1 >/dev/null
#获取编译结果
compileResult=$($compileCommand 2>&1 | base64)
if [ -f ./target/*.jar ]; then
compileResult=$(echo -n "compile successfully" | base64)
fi
}
#"$1"第几关1/2/3..)为平台传入的编译函数执行参数
compile $1
execute(){
#获取当前关卡执行文件路径
ExecutePath_Now=${ExecutePath[$1 - 1]}
#获取当前关卡执行类名
ClassName_Now=${ClassName[$1 - 1]}
res_usage="{\\"testSetUsages\\":["
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes
startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
#执行,并拼接执行结果
#使用sed命令过滤掉没用的输出
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand 2>&1 |grep -vE "spark-env|SPARK_LOCAL_IP|Printing new" |sed \'s/.*(/(/\' | base64)
#拼接输出结果
endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
let testSetCpuUsage=$endCpuUsage-$startCpuUsage
maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)
res_usage="$res_usage{\\"testSetTime\\":\\"$testSetCpuUsage\\",\\"testSetMem\\":\\"$maxMemUsage\\"},"
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
res_usage="${res_usage::-1}"
res_usage="$res_usage]}"
res_usage=$(echo -ne "$res_usage"|base64)
#return result in json format
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output,\\"resUsage\\":\\"$res_usage\\"}"
echo $result
}
#拼装成最终的json格式echo输出得到最后结果
returnResult
','Spark','Spark标准脚本','2018-01-29 15:13:08','2019-07-19 15:36:28'),
(26,32,'#!/bin/bash
cd WORKSPACE
# 待编译的评测文件
challengeProgramNames=(CHALLENGEPROGRAMNAMES)
# 编译命令
compileCommand="iverilog"
# 执行命令
executeCommand="vvp"
# 获取测试用例的输入(请勿改动此行语句)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
# 编译函数
compile(){
# 当前关卡的编译目标文件
challengeProgramName=${challengeProgramNames[$1 - 1]}
# 删除上一次编译生成的文件,防止对本次编译造成影响
rm -f ./executeFile.out &> /dev/null
# 获取编译结果(此处编译无输出则说明编译通过,否则输出编译错误信息,请按实训实际情况调整)
compileResult=$($compileCommand $challengeProgramName -o executeFile.out 2>&1 | base64)
if [ -z "$compileResult" ]; then
compileResult=$(echo -n "compile successfully" | base64)
fi
}
compile $1
# 执行函数
execute(){
# 当前关卡号
challengeStage=$1
# 循环获取各测试用例下的实际输出
res_usage="{\\"testSetUsages\\":["
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes
startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand executeFile.out 2>&1 | base64)
# 拼接输出结果
endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
let testSetCpuUsage=$endCpuUsage-$startCpuUsage
maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)
res_usage="$res_usage{\\"testSetTime\\":\\"$testSetCpuUsage\\",\\"testSetMem\\":\\"$maxMemUsage\\"},"
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
res_usage="${res_usage::-1}"
res_usage="$res_usage]}"
res_usage=$(echo -ne "$res_usage"|base64)
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output,\\"resUsage\\":\\"$res_usage\\"}"
echo $result
}
returnResult
','Verilog','Verilog标准脚本','2018-01-29 15:13:46','2019-07-19 15:49:43'),
(27,39,'#!/bin/bash
#工作空间
cd WORKSPACE
# 待编译的评测文件
challengeProgramNames=(CHALLENGEPROGRAMNAMES)
# 待执行的评测文件(可能是编译所得的可执行文件,请按实际情况填写)
sourceClassNames=(SOURCECLASSNAMES)
# 编译命令
compileCommand="mcs -warn:0"
# 执行命令
executeCommand="mono"
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
#限制每个shell连接所能写文件的最大容量100M
echo \'ulimit -f 10000\' >>/root/.bashrc ; source /root/.bashrc
compile(){
#取当前关卡的编译文件
challengeProgramName=${challengeProgramNames[$1 - 1]}
#当前关卡,作为参数传进来
challengeStage=$1
#删除上一次编译生成的文件,防止对本次编译造成影响
rm -f ./target/step$challengeStage/*.class &> /dev/null
#compile 编译文件并将编译结果输出至compile_result_$challengeStage.out
$compileCommand $challengeProgramName > compile_result_$challengeStage.out 2>&1
#检测编译输出文件是否为空,编译成功的时候没有输出,有输出就说明编译失败。
#拿到编译结果并用base64编码
compileResult=\'\'
if test -s compile_result_$challengeStage.out; then
compileResult=$(cat compile_result_$challengeStage.out | base64)
else
compileResult=$(echo -n "compile successfully" | base64)
fi
}
compile $1
execute(){
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
challengeStage=$1
res_usage="{\\"testSetUsages\\":["
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes
startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
#执行,并拼接执行结果
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
#拼接输出结果
endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
let testSetCpuUsage=$endCpuUsage-$startCpuUsage
maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)
res_usage="$res_usage{\\"testSetTime\\":\\"$testSetCpuUsage\\",\\"testSetMem\\":\\"$maxMemUsage\\"},"
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
res_usage="${res_usage::-1}"
res_usage="$res_usage]}"
res_usage=$(echo -ne "$res_usage"|base64)
#return result in json format
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output,\\"resUsage\\":\\"$res_usage\\"}"
echo $result
}
#拼装成最终的json格式echo输出得到最后结果
returnResult','C#','C#标准脚本','2018-01-29 16:17:52','2019-07-19 13:53:10'),
(29,9,'#!/bin/bash
cd WORKSPACE
# 待执行的评测文件
sourceClassNames=(SOURCECLASSNAMES)
# 执行命令
executeCommand="php"
# 获取测试用例的输入(请勿改动此行语句)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
compileResult=$(echo -n "compile successfully" | base64)
# 执行函数
execute(){
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环检测数据库是否已启动
while :;
do
mysql -h127.0.0.1 -uroot -p123123 -e "show databases" 2>&1 >/dev/null
if [ $? -eq 0 ];then
break
else
sleep 1
fi
done
# 循环获取各测试用例下的实际输出
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
# 拼接输出结果
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output}"
echo $result
}
returnResult','PHP/MYSQL','增加了检测数据库是否启动','2018-02-02 16:43:14','2018-02-02 16:43:14'),
(30,5,'#!/bin/bash
cd WORKSPACE
# 待编译的评测文件
challengeProgramNames=(CHALLENGEPROGRAMNAMES)
# 待执行的评测文件(可能是编译所得的可执行文件,请按实际情况填写)
sourceClassNames=(SOURCECLASSNAMES)
# 编译命令
compileCommand="javac -encoding UTF-8 -Djava.ext.dirs=./lib/ -sourcepath src/ -d target/"
# 执行命令
executeCommand="java -Dfile.encoding=UTF-8 -Djava.ext.dirs=./lib/ -cp target/"
# 获取测试用例的输入(请勿改动此行语句)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
# 限制每个shell连接所能写文件的最大容量
echo \'ulimit -f 10000\' >>/root/.bashrc ; source /root/.bashrc
# 编译函数
compile(){
# 当前关卡的编译目标文件
challengeProgramName=${challengeProgramNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 删除上一次编译生成的文件,防止对本次编译造成影响
rm -f ./target/step$challengeStage/*.class &> /dev/null
# 获取编译结果(此处编译无输出则说明编译通过,否则输出编译错误信息,请按实训实际情况调整)
compileResult=$($compileCommand $challengeProgramName 2>&1 | base64)
if [ -z "$compileResult" ]; then
compileResult=$(echo -n "compile successfully" | base64)
fi
}
compile $1
# 执行函数
execute(){
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环检测数据库是否已启动
while :;
do
mysql -h127.0.0.1 -uroot -p123123 -e "show databases" 2>&1 >/dev/null
if [ $? -eq 0 ];then
break
else
sleep 1
fi
done
# 循环获取各测试用例下的实际输出
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
# 拼接执行结果
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output}"
echo $result
}
returnResult
','Java/Mysql','增加了等待mysql服务启动','2018-02-02 16:44:30','2018-02-02 16:44:30'),
(31,4,'#!/bin/bash
cd WORKSPACE
# 待执行的评测文件
sourceClassNames=(SOURCECLASSNAMES)
# 执行命令
executeCommand="python"
# 获取测试用例的输入(请勿改动此行语句)
input=$2; OLD_IFS="$IFS"; IFS=,; ins=($input); IFS="$OLD_IFS"
compileResult=$(echo -n "compile successfully" | base64)
# 执行函数
execute(){
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环检测数据库是否已启动
while :;
do
mysql -h127.0.0.1 -uroot -p123123 -e "show databases" 2>&1 >/dev/null
if [ $? -eq 0 ];then
break
else
sleep 1
fi
done
# 循环获取各测试用例下的实际输出
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
#拼接输出结果
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output}"
echo $result
}
returnResult','Python2.7/Mysql','增加了等待mysql服务启动','2018-02-02 16:45:53','2018-02-02 16:45:53'),
(32,9,'#!/bin/bash
cd WORKSPACE
# 待执行的评测文件
sourceClassNames=(SOURCECLASSNAMES)
# 执行命令
executeCommand="php"
# 获取测试用例的输入(请勿改动此行语句)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
compileResult=$(echo -n "compile successfully" | base64)
# 启动php自建web服务器端口为80
runserver(){
# 判断php是否已启动未启动则启动phpweb
ps -ef | grep php | grep -v grep
if [ $? -eq 0 ]; then
nohup php -S 0.0.0.0:8080 &> /dev/null &
fi
}
runserver
# 执行函数
execute(){
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环获取各测试用例下的实际输出
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
# 拼接输出结果
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output}"
echo $result
}
returnResult','PHP-Web','PHP-Web实训','2018-02-02 17:06:57','2018-02-02 17:11:39'),
(33,64,'#!/bin/bash
cd WORKSPACE
#前台传来的可执行文件,即测试文件
sourceClassNames=(SOURCECLASSNAMES)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
#不需要编译,设定编译结果为成功编译
compileResult=$(echo -n "compile successfully" | base64)
echo \'ulimit -f 10000\' >>/root/.bashrc ; source /root/.bashrc
execute(){
executeCommand="bash "
sourceClassName=${sourceClassNames[$1 - 1]}
challengeStage=$1
#get the loop times(looptimes = the num of testdataset)
res_usage="{\\"testSetUsages\\":["
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes
startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
#执行,并拼接执行结果
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
#拼接输出结果
endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
let testSetCpuUsage=$endCpuUsage-$startCpuUsage
maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)
res_usage="$res_usage{\\"testSetTime\\":\\"$testSetCpuUsage\\",\\"testSetMem\\":\\"$maxMemUsage\\"},"
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
res_usage="${res_usage::-1}"
res_usage="$res_usage]}"
res_usage=$(echo -ne "$res_usage"|base64)
#return result in json format
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output,\\"resUsage\\":\\"$res_usage\\"}"
echo $result
}
#拼装成最终的json格式echo输出得到最后结果
returnResult','SQLite3','SQLite标准模板','2018-03-06 14:07:08','2019-07-19 15:38:42'),
(34,66,'#!/bin/bash
cd WORKSPACE
#前台传来的可执行文件,即测试文件
sourceClassNames=(SOURCECLASSNAMES)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
#不需要编译,设定编译结果为成功编译
compileResult=$(echo -n "compile successfully" | base64)
echo \'ulimit -f 10000\' >>/root/.bashrc ; source /root/.bashrc
execute(){
sourceClassName=${sourceClassNames[$1 - 1]}
executeCommand="sqlplus system/oracle @./$sourceClassName "
challengeStage=$1
while :
do
stat=`service oracle-xe status |grep READY|wc -l`
if [ $stat == 2 ];then
break
else
sleep 1
fi
done
#get the loop times(looptimes = the num of testdataset)
res_usage="{\\"testSetUsages\\":["
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes
startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
#执行,并拼接执行结果
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand |sed -n \'9,10000p\'|grep -v \'Disconnected from\' 2>&1 | base64)
#拼接输出结果
endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
let testSetCpuUsage=$endCpuUsage-$startCpuUsage
maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)
res_usage="$res_usage{\\"testSetTime\\":\\"$testSetCpuUsage\\",\\"testSetMem\\":\\"$maxMemUsage\\"},"
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
res_usage="${res_usage::-1}"
res_usage="$res_usage]}"
res_usage=$(echo -ne "$res_usage"|base64)
#return result in json format
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output,\\"resUsage\\":\\"$res_usage\\"}"
echo $result
}
#拼装成最终的json格式echo输出得到最后结果
returnResult','Oracle','Oracle标准模板','2018-03-29 15:21:34','2019-07-19 14:58:49'),
(35,94,'#!/bin/bash
cd WORKSPACE
# 待编译的评测文件
challengeProgramNames=(CHALLENGEPROGRAMNAMES)
# 待执行的评测文件(可能是编译所得的可执行文件,请按实际情况填写)
sourceClassNames=(SOURCECLASSNAMES)
# ins:各测试用例输入所组成的数组 $1:当前关卡号 $2:测试用例原始输入
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
# 限制每个shell连接所能写文件的最大容量
echo \'ulimit -f 10000\' >>/root/.bashrc ; source /root/.bashrc
# 编译函数
compile(){
# 编译命令
compileCommand="ghdl -a"
# 当前关卡的编译目标文件
challengeProgramName=${challengeProgramNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 删除上一次编译生成的文件,防止对本次编译造成影响
rm -f ./target/step$challengeStage/*.class &> /dev/null
# 获取编译结果(此处编译无输出则说明编译通过,否则输出编译错误信息,请按实训实际情况调整)
compileResult=$($compileCommand $challengeProgramName 2>&1 | base64)
if [ -z "$compileResult" ]; then
compileResult=$(echo -n "compile successfully" | base64)
fi
}
compile $1
# 执行函数
execute(){
# 执行命令
executeCommand="ghdl -r entity_name"
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环获取各测试用例下的实际输出
res_usage="{\\"testSetUsages\\":["
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes
startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
# 执行
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand 2>&1 | base64)
# 拼接执行结果
endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
let testSetCpuUsage=$endCpuUsage-$startCpuUsage
maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)
res_usage="$res_usage{\\"testSetTime\\":\\"$testSetCpuUsage\\",\\"testSetMem\\":\\"$maxMemUsage\\"},"
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
res_usage="${res_usage::-1}"
res_usage="$res_usage]}"
res_usage=$(echo -ne "$res_usage"|base64)
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output,\\"resUsage\\":\\"$res_usage\\"}"
echo $result
}
returnResult
','Vhdl','Vhdl标准模板','2018-04-04 17:22:33','2019-07-19 15:51:49'),
(36,95,'#!/bin/bash
cd WORKSPACE
# 待执行的评测文件
sourceClassNames=(SOURCECLASSNAMES)
# 执行命令
executeCommand="Rscript"
# 获取测试用例的输入(请勿改动此行语句)
input=$2; OLD_IFS="$IFS"; IFS=,; ins=($input); IFS="$OLD_IFS"
compileResult=$(echo -n "compile successfully" | base64)
# 执行函数
execute(){
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环获取各测试用例下的实际输出
res_usage="{\\"testSetUsages\\":["
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes
startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
#拼接输出结果
endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
let testSetCpuUsage=$endCpuUsage-$startCpuUsage
maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)
res_usage="$res_usage{\\"testSetTime\\":\\"$testSetCpuUsage\\",\\"testSetMem\\":\\"$maxMemUsage\\"},"
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
res_usage="${res_usage::-1}"
res_usage="$res_usage]}"
res_usage=$(echo -ne "$res_usage"|base64)
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output,\\"resUsage\\":\\"$res_usage\\"}"
echo $result
}
returnResult','R','R语言标准脚本','2018-04-08 10:32:20','2019-07-19 15:24:13'),
(37,96,'#!/bin/bash
cd WORKSPACE
#前台传来的可执行文件,即测试文件
sourceClassNames=(SOURCECLASSNAMES)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
#不需要编译,设定编译结果为成功编译
compileResult=$(echo -n "compile successfully" | base64)
echo \'ulimit -f 10000\' >>/root/.bashrc ; source /root/.bashrc
execute(){
executeCommand="swift"
sourceClassName=${sourceClassNames[$1 - 1]}
challengeStage=$1
#get the loop times(looptimes = the num of testdataset)
res_usage="{\\"testSetUsages\\":["
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes
startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
#执行,并拼接执行结果
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
#拼接输出结果
endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
let testSetCpuUsage=$endCpuUsage-$startCpuUsage
maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)
res_usage="$res_usage{\\"testSetTime\\":\\"$testSetCpuUsage\\",\\"testSetMem\\":\\"$maxMemUsage\\"},"
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
res_usage="${res_usage::-1}"
res_usage="$res_usage]}"
res_usage=$(echo -ne "$res_usage"|base64)
#return result in json format
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output,\\"resUsage\\":\\"$res_usage\\"}"
echo $result
}
#拼装成最终的json格式echo输出得到最后结果
returnResult','swift','swift标准脚本模板','2018-04-09 15:13:58','2019-07-19 15:43:46'),
(38,13,'#!/bin/bash
cd WORKSPACE
challengeProgramNames=(CHALLENGEPROGRAMNAMES)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
echo \'ulimit -f 1000000\' >>/root/.bashrc ; source /root/.bashrc
compile(){
compileCommand="g++ `pkg-config --cflags --libs opencv` "
challengeProgramName=${challengeProgramNames[$1 - 1]}
#remove the executeFile.out file that last time remains
rm -f ./executeFile.out &> /dev/null
#compile all .c file in the source folder: a/b/c.cpp --> a/b/*.cpp
challengeProgramName=${challengeProgramName%/*.cpp}"/*.cpp"
# 获取编译结果(此处编译无输出则说明编译通过,否则输出编译错误信息,请按实训实际情况调整)
compileResult=$($compileCommand $challengeProgramName -o executeFile.out 2>&1 | base64)
if [ -z "$compileResult" ]; then
compileResult=$(echo -n "compile successfully" | base64)
fi
}
compile $1
execute(){
executeCommand="./executeFile.out"
challengeStage=$1
#get the loop times(looptimes = the num of testdataset)
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
#执行,并拼接执行结果
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand | base64)
#拼接输出结果
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
#return result in json format
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output}"
echo $result
}
#拼装成最终的json格式echo输出得到最后结果
returnResult
','Opencv','修改了g++的编译参数
','2018-04-25 10:31:50','2018-04-25 10:32:14'),
(39,97,'#!/bin/bash
cd WORKSPACE
# 待执行的评测文件
sourceClassNames=(SOURCECLASSNAMES)
# 执行命令
executeCommand="sqlcmd -S localhost -U sa "
# 获取测试用例的输入(请勿改动此行语句)
input=$2; OLD_IFS="$IFS"; IFS=,; ins=($input); IFS="$OLD_IFS"
compileResult=$(echo -n "compile successfully" | base64)
# 执行函数
execute(){
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环检测数据库是否已启动
while :;
do
sqlcmd -S localhost -U sa -P \'<123123Aa!@>\' -Q "SELECT Name from sys.Databases" 2>&1 >/dev/null
if [ $? -eq 0 ];then
break
else
sleep 1
fi
done
# 循环获取各测试用例下的实际输出
res_usage="{\\"testSetUsages\\":["
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes
startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand -P \'<123123Aa!@>\' -i $sourceClassName 2>&1 | base64)
#拼接输出结果
endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
let testSetCpuUsage=$endCpuUsage-$startCpuUsage
maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)
res_usage="$res_usage{\\"testSetTime\\":\\"$testSetCpuUsage\\",\\"testSetMem\\":\\"$maxMemUsage\\"},"
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
res_usage="${res_usage::-1}"
res_usage="$res_usage]}"
res_usage=$(echo -ne "$res_usage"|base64)
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output,\\"resUsage\\":\\"$res_usage\\"}"
echo $result
}
returnResult','Sqlserver','Sqlserver标准脚本','2018-04-26 14:05:13','2019-07-19 15:40:11'),
(41,98,'#!/bin/bash
cd WORKSPACE
#前台传来的可执行文件,即测试文件
sourceClassNames=(SOURCECLASSNAMES)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
#不需要编译,设定编译结果为成功编译
compileResult=$(echo -n "compile successfully" | base64)
echo \'ulimit -f 10000\' >>/root/.bashrc ; source /root/.bashrc
execute(){
executeCommand="mysql -h127.0.0.1 -uroot -p123123 "
sourceClassName=${sourceClassNames[$1 - 1]}
challengeStage=$1
# 循环检测数据库是否已启动
while :;
do
mysql -h127.0.0.1 -uroot -p123123 -e "show databases" 2>&1 >/dev/null
if [ $? -eq 0 ];then
break
else
sleep 1
fi
done
#get the loop times(looptimes = the num of testdataset)
res_usage="{\\"testSetUsages\\":["
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes
startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
#执行,并拼接执行结果
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand < $sourceClassName 2>&1 | base64)
#拼接输出结果
endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
let testSetCpuUsage=$endCpuUsage-$startCpuUsage
maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)
res_usage="$res_usage{\\"testSetTime\\":\\"$testSetCpuUsage\\",\\"testSetMem\\":\\"$maxMemUsage\\"},"
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
res_usage="${res_usage::-1}"
res_usage="$res_usage]}"
res_usage=$(echo -ne "$res_usage"|base64)
#return result in json format
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output,\\"resUsage\\":\\"$res_usage\\"}"
echo $result
}
#拼装成最终的json格式echo输出得到最后结果
returnResult','Mysql55标准脚本','Mysql仅执行sql文件','2018-05-10 15:11:34','2019-07-19 14:48:08'),
(42,98,'#!/bin/bash
cd WORKSPACE
#前台传来的可执行文件,即测试文件
sourceClassNames=(SOURCECLASSNAMES)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
#不需要编译,设定编译结果为成功编译
compileResult=$(echo -n "compile successfully" | base64)
echo \'ulimit -f 10000\' >>/root/.bashrc ; source /root/.bashrc
execute(){
# 循环检测数据库是否已启动
while :;
do
mysql -h127.0.0.1 -uroot -p123123 -e "show databases" 2>&1 >/dev/null
if [ $? -eq 0 ];then
break
else
sleep 1
fi
done
executeCommand="bash "
sourceClassName=${sourceClassNames[$1 - 1]}
challengeStage=$1
#get the loop times(looptimes = the num of testdataset)
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
#执行,并拼接执行结果
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
#拼接输出结果
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
#return result in json format
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output}"
echo $result
}
#拼装成最终的json格式echo输出得到最后结果
returnResult','Mysql55-shell脚本','Mysql55和shell脚本结合评测','2018-05-10 15:12:00','2018-07-23 14:21:30'),
(43,97,'#!/bin/bash
cd WORKSPACE
# 待编译的评测文件
challengeProgramNames=(CHALLENGEPROGRAMNAMES)
# 待执行的评测文件(可能是编译所得的可执行文件,请按实际情况填写)
sourceClassNames=(SOURCECLASSNAMES)
# 编译命令
compileCommand="javac -encoding UTF-8 -Djava.ext.dirs=./lib/ -sourcepath src/ -d target/"
# 执行命令
executeCommand="java -Dfile.encoding=UTF-8 -Djava.ext.dirs=./lib/ -cp target/"
# 获取测试用例的输入(请勿改动此行语句)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
# 限制每个shell连接所能写文件的最大容量
echo \'ulimit -f 10000\' >>/root/.bashrc ; source /root/.bashrc
# 编译函数
compile(){
# 创建target目录
mkdir target &> /dev/null
# 当前关卡的编译目标文件
challengeProgramName=${challengeProgramNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 删除上一次编译生成的文件,防止对本次编译造成影响
rm -f ./target/step$challengeStage/*.class &> /dev/null
# 获取编译结果(此处编译无输出则说明编译通过,否则输出编译错误信息,请按实训实际情况调整)
compileResult=$($compileCommand $challengeProgramName 2>&1 | base64)
if [ -z "$compileResult" ]; then
compileResult=$(echo -n "compile successfully" | base64)
fi
}
compile $1
# 执行函数
execute(){
# 循环检测数据库是否已启动
while :;
do
sqlcmd -S localhost -U sa -P \'<123123Aa!@>\' -Q "SELECT Name from sys.Databases" 2>&1 >/dev/null
if [ $? -eq 0 ];then
break
else
sleep 1
fi
done
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环获取各测试用例下的实际输出
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
# 拼接执行结果
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output}"
echo $result
}
returnResult
','Sqlserver/Java','java代码执行sqlserver操作','2018-05-25 15:30:11','2018-05-25 15:30:11'),
(44,97,'#!/bin/bash
cd WORKSPACE
# 待执行的评测文件
sourceClassNames=(SOURCECLASSNAMES)
# 执行命令
executeCommand="bash "
# 获取测试用例的输入(请勿改动此行语句)
input=$2; OLD_IFS="$IFS"; IFS=,; ins=($input); IFS="$OLD_IFS"
compileResult=$(echo -n "compile successfully" | base64)
# 执行函数
execute(){
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环检测数据库是否已启动
while :;
do
sqlcmd -S localhost -U sa -P \'<123123Aa!@>\' -Q "SELECT Name from sys.Databases" 2>&1 >/dev/null
if [ $? -eq 0 ];then
break
else
sleep 1
fi
done
# 循环获取各测试用例下的实际输出
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName | tr -s \' \' |tr \' \' \'\\t\' 2>&1 | base64)
#拼接输出结果
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output}"
echo $result
}
returnResult','Sqlserver/Shell','','2018-06-12 17:10:44','2018-06-12 17:25:07'),
(45,102,'#!/bin/bash
cd WORKSPACE
# 待执行的评测文件
sourceClassNames=(SOURCECLASSNAMES)
# 执行命令
executeCommand="bash"
# 获取测试用例的输入(请勿改动此行语句)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
compileResult=$(echo -n "compile successfully" | base64)
# 执行函数
execute(){
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环获取各测试用例下的实际输出
res_usage="{\\"testSetUsages\\":["
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes
startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
# 拼接输出结果
endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
let testSetCpuUsage=$endCpuUsage-$startCpuUsage
maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)
res_usage="$res_usage{\\"testSetTime\\":\\"$testSetCpuUsage\\",\\"testSetMem\\":\\"$maxMemUsage\\"},"
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
res_usage="${res_usage::-1}"
res_usage="$res_usage]}"
res_usage=$(echo -ne "$res_usage"|base64)
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output,\\"resUsage\\":\\"$res_usage\\"}"
echo $result
}
returnResult','Shell/Hadoop','Shell标准脚本','2018-06-15 16:52:37','2019-07-19 15:47:05'),
(46,7,'#!/bin/bash
cd WORKSPACE
# 待执行的评测文件
sourceClassNames=(SOURCECLASSNAMES)
# 执行命令
executeCommand="bash"
# 获取测试用例的输入(请勿改动此行语句)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
compileResult=$(echo -n "compile successfully" | base64)
# 执行函数
execute(){
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环获取各测试用例下的实际输出
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
# 拼接输出结果
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output}"
echo $result
}
returnResult','Hadoop/Shell','使用shell评测','2018-07-10 09:07:17','2018-07-10 09:07:17'),
(47,2,'#!/bin/bash
cd WORKSPACE
# 待执行的评测文件
sourceClassNames=(SOURCECLASSNAMES)
# 执行命令
executeCommand="bash"
# 获取测试用例的输入(请勿改动此行语句)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
compileResult=$(echo -n "compile successfully" | base64)
# 执行函数
execute(){
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环获取各测试用例下的实际输出
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
# 拼接输出结果
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output}"
echo $result
}
returnResult','Python3.6/Shell','Shell评测脚本','2018-07-16 11:28:41','2018-07-16 11:28:41'),
(48,7,'#!/bin/bash
cd WORKSPACE
# 待编译的评测文件
challengeProgramNames=(CHALLENGEPROGRAMNAMES)
# 待执行的评测文件
sourceClassNames=(SOURCECLASSNAMES)
# 获取测试用例的输入(请勿改动此行语句)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
# 编译函数
compile(){
cd step$1
# 编译命令
compileCommand="/apache-ant-1.10.1/bin/ant -q -S"
# 取当前关卡的编译文件
challengeProgramName=${challengeProgramNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
############################################
compileResult=$($compileCommand 2>&1)
echo $compileResult |grep \'BUILD FAILED\' >/dev/null
if [[ $? == 0 ]]; then
compileResult=$(echo -n $compileResult | base64)
else
compileResult=$(echo -n "compile successfully" | base64)
fi
}
compile $1
execute(){
# 执行命令
executeCommand="sh $1.sh"
# 执行文件名
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环获取各测试用例下的实际输出
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
# 拼接输出结果
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output}"
echo $result
}
returnResult
','Hadoop/v2.0','优化了评测脚本输出报错信息','2018-08-02 09:36:26','2018-08-02 09:36:26'),
(49,104,'#!/bin/bash
cd WORKSPACE
# 待执行的评测文件
sourceClassNames=(SOURCECLASSNAMES)
# 执行命令
executeCommand="python"
# 获取测试用例的输入(请勿改动此行语句)
input=$2; OLD_IFS="$IFS"; IFS=,; ins=($input); IFS="$OLD_IFS"
compileResult=$(echo -n "compile successfully" | base64)
# 执行函数
execute(){
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环获取各测试用例下的实际输出
res_usage="{\\"testSetUsages\\":["
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes
startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
#拼接输出结果
endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
let testSetCpuUsage=$endCpuUsage-$startCpuUsage
maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)
res_usage="$res_usage{\\"testSetTime\\":\\"$testSetCpuUsage\\",\\"testSetMem\\":\\"$maxMemUsage\\"},"
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
res_usage="${res_usage::-1}"
res_usage="$res_usage]}"
res_usage=$(echo -ne "$res_usage"|base64)
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output,\\"resUsage\\":\\"$res_usage\\"}"
echo $result
}
returnResult','Mongo/Python','python3评测','2018-08-02 15:33:19','2019-07-19 14:45:30'),
(50,104,'#!/bin/bash
cd WORKSPACE
# 待执行的评测文件
sourceClassNames=(SOURCECLASSNAMES)
# 执行命令
executeCommand="bash"
# 获取测试用例的输入(请勿改动此行语句)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
compileResult=$(echo -n "compile successfully" | base64)
# 执行函数
execute(){
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环获取各测试用例下的实际输出
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
# 拼接输出结果
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output}"
echo $result
}
returnResult','Mongo/Shell','shell脚本评测','2018-08-02 15:33:53','2018-08-02 15:33:53'),
(54,106,'#!/bin/bash
cd WORKSPACE
# 待执行的评测文件
sourceClassNames=(SOURCECLASSNAMES)
# 执行命令
executeCommand="bash"
# 获取测试用例的输入(请勿改动此行语句)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
compileResult=$(echo -n "compile successfully" | base64)
# 执行函数
execute(){
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环获取各测试用例下的实际输出
res_usage="{\\"testSetUsages\\":["
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes
startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
# 拼接输出结果
endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
let testSetCpuUsage=$endCpuUsage-$startCpuUsage
maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)
res_usage="$res_usage{\\"testSetTime\\":\\"$testSetCpuUsage\\",\\"testSetMem\\":\\"$maxMemUsage\\"},"
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
res_usage="${res_usage::-1}"
res_usage="$res_usage]}"
res_usage=$(echo -ne "$res_usage"|base64)
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output,\\"resUsage\\":\\"$res_usage\\"}"
echo $result
}
returnResult','Python3-vnc/Shell','shell','2018-09-10 09:11:01','2019-07-19 15:20:06'),
(55,22,'#!/bin/bash
cd WORKSPACE/verifycode
sourceClassNames=("com.servlet.CodeTest.txt" "com.servlet.LoginTest.txt" "com.servlet.CaptchaTest.txt")
OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
startJetty(){
nohup mvn jetty:run-war &> /dev/null &
}
restartJetty(){
rm nohup.out
mvn jetty:stop &> nohup.out
startJetty
while :;
do
sleep 1
netstat -antplu |grep 8080 &> /dev/null
if [ $? -eq 0 ]
then
break
fi
done
}
compile(){
compileCommand="mvn compiler:compile"
compileResult=$($compileCommand 2>&1)
if [[ $(echo $?) -ne 0 ]]; then
compileResult=$(echo -n $compileResult | base64)
else
compileResult=$(echo -n "compile successfully" | base64)
restartJetty
fi
}
compile
execute(){
sourceClassName=${sourceClassNames[$1 - 1]}
executeCommand="echo $(awk -F \',\' \'{print $2 $3}\' target/surefire-reports/"${sourceClassName}" ) "
output=\'\'
#执行,并拼接执行结果
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand 2>&1 | base64)
#拼接输出结果
output=$output\\"$result\\",
output="[${output%?}]"
}
execute $1
#return result in json format
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output}"
echo $result
}
returnResult','Mvn/Jetty','Mvn/Jetty','2018-09-17 15:40:14','2018-09-17 15:40:14'),
(56,107,'#!/bin/bash
cd WORKSPACE
# 待执行的评测文件
sourceClassNames=(SOURCECLASSNAMES)
# 执行命令
executeCommand="python"
# 获取测试用例的输入(请勿改动此行语句)
input=$2; OLD_IFS="$IFS"; IFS=,; ins=($input); IFS="$OLD_IFS"
compileResult=$(echo -n "compile successfully" | base64)
# 执行函数
execute(){
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环获取各测试用例下的实际输出
res_usage="{\\"testSetUsages\\":["
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes
startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
#拼接输出结果
endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
let testSetCpuUsage=$endCpuUsage-$startCpuUsage
maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)
res_usage="$res_usage{\\"testSetTime\\":\\"$testSetCpuUsage\\",\\"testSetMem\\":\\"$maxMemUsage\\"},"
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
res_usage="${res_usage::-1}"
res_usage="$res_usage]}"
res_usage=$(echo -ne "$res_usage"|base64)
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output,\\"resUsage\\":\\"$res_usage\\"}"
echo $result
}
returnResult','python','','2018-10-29 10:25:27','2019-07-19 15:15:57'),
(57,108,'#!/bin/bash
cd WORKSPACE
# 待执行的评测文件
sourceClassNames=(SOURCECLASSNAMES)
# 执行命令
executeCommand="bash"
# 获取测试用例的输入(请勿改动此行语句)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
compileResult=$(echo -n "compile successfully" | base64)
# 执行函数
execute(){
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环获取各测试用例下的实际输出
res_usage="{\\"testSetUsages\\":["
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes
startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
# 拼接输出结果
endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
let testSetCpuUsage=$endCpuUsage-$startCpuUsage
maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)
res_usage="$res_usage{\\"testSetTime\\":\\"$testSetCpuUsage\\",\\"testSetMem\\":\\"$maxMemUsage\\"},"
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
res_usage="${res_usage::-1}"
res_usage="$res_usage]}"
res_usage=$(echo -ne "$res_usage"|base64)
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output,\\"resUsage\\":\\"$res_usage\\"}"
echo $result
}
returnResult','Hbase/shell','使用shell评测','2018-11-14 13:18:24','2019-07-19 11:40:27'),
(58,109,'#!/bin/bash
cd WORKSPACE
# 待执行的评测文件
sourceClassNames=(SOURCECLASSNAMES)
# 执行命令
executeCommand="bash"
# 获取测试用例的输入(请勿改动此行语句)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
compileResult=$(echo -n "compile successfully" | base64)
# 执行函数
execute(){
while :;
do
sudo -u postgres psql -c "\\dt" 2>&1 > /dev/null 2>&1 >/dev/null
if [ $? -eq 0 ];then
break
else
sleep 1
fi
done
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环获取各测试用例下的实际输出
res_usage="{\\"testSetUsages\\":["
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes
startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
# 拼接输出结果
endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
let testSetCpuUsage=$endCpuUsage-$startCpuUsage
maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)
res_usage="$res_usage{\\"testSetTime\\":\\"$testSetCpuUsage\\",\\"testSetMem\\":\\"$maxMemUsage\\"},"
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
res_usage="${res_usage::-1}"
res_usage="$res_usage]}"
res_usage=$(echo -ne "$res_usage"|base64)
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output,\\"resUsage\\":\\"$res_usage\\"}"
echo $result
}
returnResult','PostgreSql/Shell','','2018-11-15 12:16:46','2019-07-19 15:06:01'),
(59,110,'#!/bin/bash
cd WORKSPACE
# 待执行的评测文件
sourceClassNames=(SOURCECLASSNAMES)
# 执行命令
executeCommand="bash"
# 获取测试用例的输入(请勿改动此行语句)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
compileResult=$(echo -n "compile successfully" | base64)
# 执行函数
execute(){
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环获取各测试用例下的实际输出
res_usage="{\\"testSetUsages\\":["
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes
startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
# 拼接输出结果
endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
let testSetCpuUsage=$endCpuUsage-$startCpuUsage
maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)
res_usage="$res_usage{\\"testSetTime\\":\\"$testSetCpuUsage\\",\\"testSetMem\\":\\"$maxMemUsage\\"},"
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
res_usage="${res_usage::-1}"
res_usage="$res_usage]}"
res_usage=$(echo -ne "$res_usage"|base64)
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output,\\"resUsage\\":\\"$res_usage\\"}"
echo $result
}
returnResult','Hbase2/shell','','2018-11-18 15:28:30','2019-07-19 14:12:12'),
(60,111,'#!/bin/bash
cd WORKSPACE
# 待执行的评测文件
sourceClassNames=(SOURCECLASSNAMES)
# 执行命令
executeCommand="bash"
# 获取测试用例的输入(请勿改动此行语句)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
compileResult=$(echo -n "compile successfully" | base64)
# 执行函数
execute(){
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环获取各测试用例下的实际输出
res_usage="{\\"testSetUsages\\":["
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes
startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
# 拼接输出结果
endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
let testSetCpuUsage=$endCpuUsage-$startCpuUsage
maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)
res_usage="$res_usage{\\"testSetTime\\":\\"$testSetCpuUsage\\",\\"testSetMem\\":\\"$maxMemUsage\\"},"
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
res_usage="${res_usage::-1}"
res_usage="$res_usage]}"
res_usage=$(echo -ne "$res_usage"|base64)
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output,\\"resUsage\\":\\"$res_usage\\"}"
echo $result
}
returnResult','Hbase-simple/Shell','','2018-11-30 15:11:45','2019-07-19 14:10:00'),
(61,29,'#!/bin/bash
cd WORKSPACE
# 待编译的评测文件
challengeProgramNames=(CHALLENGEPROGRAMNAMES)
# 待执行的评测文件(可能是编译所得的可执行文件,请按实际情况填写)
sourceClassNames=(SOURCECLASSNAMES)
# 编译命令
compileCommand="scalac -encoding UTF-8 -sourcepath src/ -d target/"
# 执行命令
executeCommand="scala -Dfile.encoding=UTF-8 -cp target/"
# 获取测试用例的输入(请勿改动此行语句)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
# 限制每个shell连接所能写文件的最大容量
echo \'ulimit -f 10000\' >>/root/.bashrc ; source /root/.bashrc
# 编译函数
compile(){
# 创建target目录
mkdir target &> /dev/null
# 当前关卡的编译目标文件
challengeProgramName=${challengeProgramNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 删除上一次编译生成的文件,防止对本次编译造成影响
rm -rf ./target/** &> /dev/null
# 获取编译结果(此处编译无输出则说明编译通过,否则输出编译错误信息,请按实训实际情况调整)
compileResult=$($compileCommand $challengeProgramName 2>&1 | base64)
if [ -z "$compileResult" ]; then
compileResult=$(echo -n "compile successfully" | base64)
fi
}
compile $1
# 执行函数
execute(){
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环获取各测试用例下的实际输出
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
# 拼接执行结果
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output}"
echo $result
}
returnResult
','Scala','','2018-12-09 16:26:59','2018-12-10 16:19:29'),
(62,112,'#!/bin/bash
cd WORKSPACE
# 待执行的评测文件
sourceClassNames=(SOURCECLASSNAMES)
# 执行命令
executeCommand="bash"
# 获取测试用例的输入(请勿改动此行语句)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
compileResult=$(echo -n "compile successfully" | base64)
# 执行函数
execute(){
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环获取各测试用例下的实际输出
res_usage="{\\"testSetUsages\\":["
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes
startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
# 拼接输出结果
endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
let testSetCpuUsage=$endCpuUsage-$startCpuUsage
maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)
res_usage="$res_usage{\\"testSetTime\\":\\"$testSetCpuUsage\\",\\"testSetMem\\":\\"$maxMemUsage\\"},"
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
res_usage="${res_usage::-1}"
res_usage="$res_usage]}"
res_usage=$(echo -ne "$res_usage"|base64)
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output,\\"resUsage\\":\\"$res_usage\\"}"
echo $result
}
returnResult','Sqoop/shell','','2018-12-18 09:22:55','2019-07-19 15:41:44'),
(63,114,'#!/bin/bash
cd WORKSPACE
challengeProgramNames=(CHALLENGEPROGRAMNAMES)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
echo \'ulimit -f 1000000\' >>/root/.bashrc ; source /root/.bashrc
compile(){
#example编译命令nasm -f elf64 hello.asm
compileCommand="nasm -f elf64 "
challengeProgramName_only=${challengeProgramNames[$1 - 1]}
#remove the executeFile.out file that last time remains
rm -f ./executeFile.out &> /dev/null
rm -f ./executeFile1.out &> /dev/null
#compile all .s file in the source folder: a/b/c.s --> a/b/*.s
challengeProgramName=${challengeProgramName_only%/*.s}"/*.s"
# 获取编译结果(此处编译无输出则说明编译通过,否则输出编译错误信息,请按实训实际情况调整)
compileResult=$($compileCommand $challengeProgramName -o executeFile1.out 2>&1 | base64)
if [ -z "$compileResult" ]; then
compileResult=$(echo -n "compile successfully" | base64)
fi
#example编译命令ld -s hello -o hello.o
compileResult=$(ld -s executeFile1.out -o executeFile.out 2>&1 | base64)
# 获取编译结果(此处编译无输出则说明编译通过,否则输出编译错误信息,请按实训实际情况调整)
if [ -z "$compileResult" ]; then
compileResult1=$(echo -n "compile successfully" | base64)
fi
}
compile $1
execute(){
executeCommand="./executeFile.out"
challengeStage=$1
#get the loop times(looptimes = the num of testdataset)
res_usage="{\\"testSetUsages\\":["
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes
startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
#执行,并拼接执行结果
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand | base64)
#拼接输出结果
endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
let testSetCpuUsage=$endCpuUsage-$startCpuUsage
maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)
res_usage="$res_usage{\\"testSetTime\\":\\"$testSetCpuUsage\\",\\"testSetMem\\":\\"$maxMemUsage\\"},"
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
res_usage="${res_usage::-1}"
res_usage="$res_usage]}"
res_usage=$(echo -ne "$res_usage"|base64)
#return result in json format
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output,\\"resUsage\\":\\"$res_usage\\"}"
echo $result
}
#拼装成最终的json格式echo输出得到最后结果
returnResult','Nasm/shell','','2019-02-18 17:14:35','2019-07-19 14:50:52'),
(64,34,'#!/bin/bash
cd WORKSPACE
# 待执行的评测文件
sourceClassNames=(SOURCECLASSNAMES)
# 执行命令
executeCommand="python"
# 获取测试用例的输入(请勿改动此行语句)
input=$2; OLD_IFS="$IFS"; IFS=,; ins=($input); IFS="$OLD_IFS"
compileResult=$(echo -n "compile successfully" | base64)
# 执行函数
execute(){
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环获取各测试用例下的实际输出
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
#拼接输出结果
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output}"
echo $result
}
returnResult','Docker/python脚本','使用Python脚本进行评测。','2019-02-22 14:23:47','2019-02-22 14:23:47'),
(66,5,'#!/bin/bash
cd WORKSPACE
# 待执行的评测文件
sourceClassNames=(SOURCECLASSNAMES)
# 执行命令
executeCommand="bash"
# 获取测试用例的输入(请勿改动此行语句)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
compileResult=$(echo -n "compile successfully" | base64)
# 执行函数
execute(){
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环获取各测试用例下的实际输出
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
# 拼接输出结果
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output}"
echo $result
}
returnResult','Java/Shell','Shell评测脚本','2019-03-07 16:14:54','2019-03-12 16:36:52'),
(68,116,'#!/bin/bash
cd WORKSPACE
# 待执行的评测文件
sourceClassNames=(SOURCECLASSNAMES)
# 执行命令
executeCommand="bash"
# 获取测试用例的输入(请勿改动此行语句)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
compileResult=$(echo -n "compile successfully" | base64)
# 执行函数
execute(){
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环获取各测试用例下的实际输出
res_usage="{\\"testSetUsages\\":["
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes
startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
# 拼接输出结果
endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
let testSetCpuUsage=$endCpuUsage-$startCpuUsage
maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)
res_usage="$res_usage{\\"testSetTime\\":\\"$testSetCpuUsage\\",\\"testSetMem\\":\\"$maxMemUsage\\"},"
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
res_usage="${res_usage::-1}"
res_usage="$res_usage]}"
res_usage=$(echo -ne "$res_usage"|base64)
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output,\\"resUsage\\":\\"$res_usage\\"}"
echo $result
}
returnResult','Python3-tentensorflow1.5/Shell','','2019-03-08 10:50:49','2019-07-19 15:17:55'),
(69,116,'#!/bin/bash
cd WORKSPACE
# 待执行的评测文件
sourceClassNames=(SOURCECLASSNAMES)
# 执行命令
executeCommand="python"
# 获取测试用例的输入(请勿改动此行语句)
input=$2; OLD_IFS="$IFS"; IFS=,; ins=($input); IFS="$OLD_IFS"
compileResult=$(echo -n "compile successfully" | base64)
# 执行函数
execute(){
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环获取各测试用例下的实际输出
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
#拼接输出结果
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output}"
echo $result
}
returnResult','Python3-tentensorflow1.5','','2019-03-08 10:50:59','2019-03-08 10:50:59'),
(71,22,'#!/bin/bash
cd WORKSPACE
# 待执行的评测文件
sourceClassNames=(SOURCECLASSNAMES)
# 执行命令
executeCommand="bash"
# 获取测试用例的输入(请勿改动此行语句)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
compileResult=$(echo -n "compile successfully" | base64)
# 执行函数
execute(){
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环获取各测试用例下的实际输出
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
# 拼接输出结果
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output}"
echo $result
}
returnResult','JavaWeb/Shell','java shell脚本','2019-03-12 16:52:10','2019-03-12 16:52:10'),
(73,13,'#!/bin/bash
cd WORKSPACE
# 待执行的评测文件
sourceClassNames=(SOURCECLASSNAMES)
# 执行命令
executeCommand="bash"
# 获取测试用例的输入(请勿改动此行语句)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
compileResult=$(echo -n "compile successfully" | base64)
# 执行函数
execute(){
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环获取各测试用例下的实际输出
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
# 拼接输出结果
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output}"
echo $result
}
returnResult','C/Shell','shell脚本执行','2019-03-18 17:43:29','2019-03-18 17:43:29'),
(74,118,'#!/bin/bash
cd WORKSPACE
# 待执行的评测文件
sourceClassNames=(SOURCECLASSNAMES)
# 执行命令
executeCommand="bash"
# 获取测试用例的输入(请勿改动此行语句)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
compileResult=$(echo -n "compile successfully" | base64)
# 执行函数
execute(){
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环获取各测试用例下的实际输出
res_usage="{\\"testSetUsages\\":["
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes
startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
# 拼接输出结果
endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
let testSetCpuUsage=$endCpuUsage-$startCpuUsage
maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)
res_usage="$res_usage{\\"testSetTime\\":\\"$testSetCpuUsage\\",\\"testSetMem\\":\\"$maxMemUsage\\"},"
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
res_usage="${res_usage::-1}"
res_usage="$res_usage]}"
res_usage=$(echo -ne "$res_usage"|base64)
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output,\\"resUsage\\":\\"$res_usage\\"}"
echo $result
}
returnResult','Kafka/Shell','','2019-03-20 17:35:42','2019-07-19 14:24:39'),
(75,10,'#!/bin/bash
cd WORKSPACE
# 待执行的评测文件
sourceClassNames=(SOURCECLASSNAMES)
# 执行命令
executeCommand="bash"
# 获取测试用例的输入(请勿改动此行语句)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
compileResult=$(echo -n "compile successfully" | base64)
# 执行函数
execute(){
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环获取各测试用例下的实际输出
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
# 拼接输出结果
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output}"
echo $result
}
returnResult','Matlab/Shell','','2019-03-25 10:07:54','2019-06-25 14:25:55'),
(77,2,'#!/bin/bash
cd WORKSPACE
# 待执行的评测文件
sourceClassNames=(SOURCECLASSNAMES)
# 执行命令
executeCommand="python"
# 获取测试用例的输入(请勿改动此行语句)
input=$2; OLD_IFS="$IFS"; IFS=,; ins=($input); IFS="$OLD_IFS"
#启动php自建web服务器端口为80
runserver(){
pkill -f "manage.py runserver"
lsof -i:8080 &> /dev/null
if [ $? -eq 1 ]; then
nohup python ${sourceClassNames[$1 - 1]} runserver 0.0.0.0:8080 &> /dev/null &
fi
while :;
do
sleep 1
lsof -i:8080 &> /dev/null
if [ $? -eq 0 ]
then
break
fi
done
}
runserver $1
compileResult=$(echo -n "compile successfully" | base64)
# 执行函数
execute(){
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环获取各测试用例下的实际输出
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName test apptest 2>&1)
result=$(echo "${result/in [0-9].[0-9][0-9][0-9]s}" | base64)
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output}"
echo $result
}
returnResult','Python3.6/Django','注意请将以下第45行代码中的“apptese”修改为你自己项目的app名称
运行Django项目运行项目后执行tests.py测试文件请在项目的tests.py文件中写好测试代码。运行测试代码时会去掉"in 0.000s"时间)','2019-04-12 17:06:00','2019-06-04 17:49:35'),
(78,29,'#!/bin/bash
cd WORKSPACE
# 待执行的评测文件
sourceClassNames=(SOURCECLASSNAMES)
# 执行命令
executeCommand="bash"
# 获取测试用例的输入(请勿改动此行语句)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
compileResult=$(echo -n "compile successfully" | base64)
# 执行函数
execute(){
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环获取各测试用例下的实际输出
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
# 拼接输出结果
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output}"
echo $result
}
returnResult','spark-shell','shell脚本','2019-04-22 10:26:39','2019-04-22 10:26:39'),
(79,109,'#!/bin/bash
cd WORKSPACE
# 待执行的评测文件
sourceClassNames=(SOURCECLASSNAMES)
# 执行命令
executeCommand="python"
# 获取测试用例的输入(请勿改动此行语句)
input=$2; OLD_IFS="$IFS"; IFS=,; ins=($input); IFS="$OLD_IFS"
compileResult=$(echo -n "compile successfully" | base64)
# 执行函数
execute(){
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环获取各测试用例下的实际输出
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
#拼接输出结果
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output}"
echo $result
}
returnResult','PostgreSql/Python','','2019-05-07 15:28:55','2019-05-07 15:28:55'),
(80,119,'#!/bin/bash
cd WORKSPACE
# 待执行的评测文件
sourceClassNames=(SOURCECLASSNAMES)
# 执行命令
executeCommand="bash"
# 获取测试用例的输入(请勿改动此行语句)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
compileResult=$(echo -n "compile successfully" | base64)
# 执行函数
execute(){
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环获取各测试用例下的实际输出
res_usage="{\\"testSetUsages\\":["
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes
startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
# 拼接输出结果
endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
let testSetCpuUsage=$endCpuUsage-$startCpuUsage
maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)
res_usage="$res_usage{\\"testSetTime\\":\\"$testSetCpuUsage\\",\\"testSetMem\\":\\"$maxMemUsage\\"},"
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
res_usage="${res_usage::-1}"
res_usage="$res_usage]}"
res_usage=$(echo -ne "$res_usage"|base64)
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output,\\"resUsage\\":\\"$res_usage\\"}"
echo $result
}
returnResult','Shell/vscode','','2019-05-29 17:43:47','2019-07-19 15:53:12'),
(81,120,'#!/bin/bash
cd WORKSPACE
challengeProgramNames=(CHALLENGEPROGRAMNAMES)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
echo \'ulimit -f 1000000\' >>/root/.bashrc ; source /root/.bashrc
compile(){
compileCommand="gcc -lm -lc -lz "
challengeProgramName=${challengeProgramNames[$1 - 1]}
#remove the executeFile.out file that last time remains
rm -f ./executeFile.out &> /dev/null
#compile all .c file in the source folder: a/b/c.c --> a/b/*.c
challengeProgramName=${challengeProgramName%/*.c}"/*.c"
# 获取编译结果(此处编译无输出则说明编译通过,否则输出编译错误信息,请按实训实际情况调整)
compileResult=$($compileCommand $challengeProgramName -o executeFile.out 2>&1 | base64)
if [ -z "$compileResult" ]; then
compileResult=$(echo -n "compile successfully" | base64)
fi
}
compile $1
execute(){
executeCommand="./executeFile.out"
challengeStage=$1
#get the loop times(looptimes = the num of testdataset)
res_usage="{\\"testSetUsages\\":["
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes
startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
#执行,并拼接执行结果
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand | base64)
#拼接输出结果
endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
let testSetCpuUsage=$endCpuUsage-$startCpuUsage
maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)
res_usage="$res_usage{\\"testSetTime\\":\\"$testSetCpuUsage\\",\\"testSetMem\\":\\"$maxMemUsage\\"},"
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
res_usage="${res_usage::-1}"
res_usage="$res_usage]}"
res_usage=$(echo -ne "$res_usage"|base64)
#return result in json format
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output,\\"resUsage\\":\\"$res_usage\\"}"
echo $result
}
#拼装成最终的json格式echo输出得到最后结果
returnResult
','GPU/C','','2019-06-05 17:48:14','2019-07-19 11:36:10'),
(82,120,'#!/bin/bash
cd WORKSPACE
challengeProgramNames=(CHALLENGEPROGRAMNAMES)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
echo \'ulimit -f 1000000\' >>/root/.bashrc ; source /root/.bashrc
compile(){
compileCommand="g++ "
challengeProgramName=${challengeProgramNames[$1 - 1]}
#remove the executeFile.out file that last time remains
rm -f ./executeFile.out &> /dev/null
#compile all .c file in the source folder: a/b/c.cpp --> a/b/*.cpp
challengeProgramName=${challengeProgramName%/*.cpp}"/*.cpp"
# 获取编译结果(此处编译无输出则说明编译通过,否则输出编译错误信息,请按实训实际情况调整)
compileResult=$($compileCommand $challengeProgramName -o executeFile.out 2>&1 | base64)
if [ -z "$compileResult" ]; then
compileResult=$(echo -n "compile successfully" | base64)
fi
}
compile $1
execute(){
executeCommand="./executeFile.out"
challengeStage=$1
#get the loop times(looptimes = the num of testdataset)
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
#执行,并拼接执行结果
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand | base64)
#拼接输出结果
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
#return result in json format
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output}"
echo $result
}
#拼装成最终的json格式echo输出得到最后结果
returnResult
','GPU/C++','','2019-06-05 17:48:36','2019-06-05 17:48:36'),
(83,120,'#!/bin/bash
cd WORKSPACE
# 待执行的评测文件
sourceClassNames=(SOURCECLASSNAMES)
# 执行命令
executeCommand="bash"
# 获取测试用例的输入(请勿改动此行语句)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
compileResult=$(echo -n "compile successfully" | base64)
# 执行函数
execute(){
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环获取各测试用例下的实际输出
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
# 拼接输出结果
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output}"
echo $result
}
returnResult','GPU/C/Shell','','2019-06-05 17:48:57','2019-06-05 17:48:57'),
(84,123,'#!/bin/bash
cd WORKSPACE
# 待执行的评测文件
sourceClassNames=(SOURCECLASSNAMES)
# 执行命令
executeCommand="bash"
# 获取测试用例的输入(请勿改动此行语句)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
compileResult=$(echo -n "compile successfully" | base64)
# 执行函数
execute(){
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环获取各测试用例下的实际输出
res_usage="{\\"testSetUsages\\":["
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes
startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
# 拼接输出结果
endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
let testSetCpuUsage=$endCpuUsage-$startCpuUsage
maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)
res_usage="$res_usage{\\"testSetTime\\":\\"$testSetCpuUsage\\",\\"testSetMem\\":\\"$maxMemUsage\\"},"
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
res_usage="${res_usage::-1}"
res_usage="$res_usage]}"
res_usage=$(echo -ne "$res_usage"|base64)
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output,\\"resUsage\\":\\"$res_usage\\"}"
echo $result
}
returnResult','Shell/Flink','','2019-06-17 16:19:57','2019-07-19 11:29:05'),
(85,124,'#!/bin/bash
cd WORKSPACE
# 待执行的评测文件
sourceClassNames=(SOURCECLASSNAMES)
# 执行命令
executeCommand="bash"
# 获取测试用例的输入(请勿改动此行语句)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
compileResult=$(echo -n "compile successfully" | base64)
# 执行函数
execute(){
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环获取各测试用例下的实际输出
res_usage="{\\"testSetUsages\\":["
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes
startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
# 拼接输出结果
endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
let testSetCpuUsage=$endCpuUsage-$startCpuUsage
maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)
res_usage="$res_usage{\\"testSetTime\\":\\"$testSetCpuUsage\\",\\"testSetMem\\":\\"$maxMemUsage\\"},"
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
res_usage="${res_usage::-1}"
res_usage="$res_usage]}"
res_usage=$(echo -ne "$res_usage"|base64)
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output,\\"resUsage\\":\\"$res_usage\\"}"
echo $result
}
returnResult','Matlab-vnc/shell','','2019-06-25 14:26:19','2019-07-19 14:42:10'),
(86,127,'#!/bin/bash
cd WORKSPACE
# 待执行的评测文件
sourceClassNames=(SOURCECLASSNAMES)
# 执行命令
executeCommand="bash"
# 获取测试用例的输入(请勿改动此行语句)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
compileResult=$(echo -n "compile successfully" | base64)
# 执行函数
execute(){
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环获取各测试用例下的实际输出
res_usage="{\\"testSetUsages\\":["
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes
startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
# 拼接输出结果
endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
let testSetCpuUsage=$endCpuUsage-$startCpuUsage
maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)
res_usage="$res_usage{\\"testSetTime\\":\\"$testSetCpuUsage\\",\\"testSetMem\\":\\"$maxMemUsage\\"},"
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
res_usage="${res_usage::-1}"
res_usage="$res_usage]}"
res_usage=$(echo -ne "$res_usage"|base64)
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output,\\"resUsage\\":\\"$res_usage\\"}"
echo $result
}
returnResult','Shell/cisco','','2019-07-17 17:06:00','2019-07-19 13:54:05'),
(87,115,'#!/bin/bash
cd WORKSPACE
# 待执行的评测文件
sourceClassNames=(SOURCECLASSNAMES)
# 执行命令
executeCommand="bash"
# 获取测试用例的输入(请勿改动此行语句)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
compileResult=$(echo -n "compile successfully" | base64)
# 执行函数
execute(){
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环获取各测试用例下的实际输出
res_usage="{\\"testSetUsages\\":["
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes
startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
# 拼接输出结果
endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)
let testSetCpuUsage=$endCpuUsage-$startCpuUsage
maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)
res_usage="$res_usage{\\"testSetTime\\":\\"$testSetCpuUsage\\",\\"testSetMem\\":\\"$maxMemUsage\\"},"
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
res_usage="${res_usage::-1}"
res_usage="$res_usage]}"
res_usage=$(echo -ne "$res_usage"|base64)
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output,\\"resUsage\\":\\"$res_usage\\"}"
echo $result
}
returnResult','Python-Gpu/Shell','','2019-07-19 15:10:36','2019-07-19 15:13:52');
DROP TABLE IF EXISTS `platform_samples`;
CREATE TABLE `platform_samples` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`samples_type` varchar(255) DEFAULT NULL,
`contents` text,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
insert into `platform_samples`(`id`,`samples_type`,`contents`,`created_at`,`updated_at`) values
(1,'taskPass','[TOC]
---
####任务描述
本关任务:编写一个能计算数组平均值和最大值的小程序。
####相关知识
为了完成本关任务你需要掌握1.如何获取数组的长度2.如何遍历数组。
#####获取数组的长度
数组的`length`属性用于记录数组中有多少个元素或存储单元,即记录数组的长度是多少。
```java
int[] nums = new int[10];//声明一个int型数组并动态初始化其大小为10
System.out.println(nums.length);//显示当前数组的大小
```
输出:`10`
#####遍历数组
通俗的理解,遍历数组就是:**把数组中的元素都看一遍**。
示例如下:
```java
int[] arr = {1,3,5,7,9};
for(int i = 0 ; i<arr.length; i++){
System.out.print(arr[i] + ",");
}
```
输出:`1,3,5,7,9`
#####如何求出最大值
求数组的最大值,是不是很像打擂台呢?
对于一群人我们不知道谁最厉害所以我们准备一个擂台并挑选第一个人为擂主max擂台下的人不断的循环来挑战擂主如果赢了那挑战者就是擂主之前的擂主就下台了直到没有挑战者了那最后一个擂主就是最厉害的那个了。
####编程要求
根据提示,在右侧编辑器补充代码,计算并输出数组的平均值和最大值。
####测试说明
平台会对你编写的代码进行测试:
测试输入:`4``91``51``2``32`
预期输出:
`平均值44.0`
`最大值91`
测试输入:`5``1``151``12``22``100`
预期输出:
`平均值57.2`
`最大值151`
提示:
```java
int a = 3;
int b = 2;
System.out.println(a/b);
System.out.println((double)(a/b));
```
输出:
`1`
`1.5`
---
开始你的任务吧,祝你成功!
','2018-01-05 21:10:42','2018-11-26 09:09:43'),
(2,'script','#!/bin/bash
cd WORKSPACE
# 待编译的评测文件
challengeProgramNames=(CHALLENGEPROGRAMNAMES)
# 待执行的评测文件(可能是编译所得的可执行文件,请按实际情况填写)
sourceClassNames=(SOURCECLASSNAMES)
# 获取测试用例的输入(请勿改动此行语句)
input=$2;OLD_IFS="$IFS"; IFS=,; ins=($input);IFS="$OLD_IFS"
COMPILEFUNCTION
execute(){
# 执行命令
executeCommand="EXECUTECOMMAND"
# 当前关卡的执行目标文件
sourceClassName=${sourceClassNames[$1 - 1]}
# 当前关卡号
challengeStage=$1
# 循环获取各测试用例下的实际输出
output=\'\'
i=0
while [[ i -lt ${#ins[*]} ]]; do
result=$(echo "${ins[$i]}" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)
# 拼接输出结果
output=$output\\"$result\\",
let i++
done
output="[${output%?}]"
}
execute $1
# 返回评测结果
returnResult(){
result="{\\"compileResult\\":\\"$compileResult\\",\\"out\\":$output}"
echo $result
}
returnResult','2018-01-29 16:21:11','2018-02-01 14:36:37'),
(3,'introduction','[comment]: <> (请在此添加实训简介,简单介绍一下实训的内容.以下是“基于Java语言的链表编程实训基础篇”实训的示例文)
链表Linked List是一种通用的数据结构主要用于表示和管理数量不确定的数据。链表可有效解决数组Array在动态数据管理方面的不足。
本实训项目的主要内容是基于Java语言开发一个具有基本功能的单链表从六个方面介绍链表相关知识并设置了六个关卡在线考察大家的链表编程能力。
![](/api/attachments/169735)','2018-02-07 17:02:53','2018-02-07 17:02:53'),
(4,'knowledge','[comment]: <> (请在此添加实训历史背景、应用背景拓展学员视野.以下是“基于Java语言的链表编程实训基础篇”实训的示例)
#### 链表的历史
1955至1956年间链表由Allen Newell、Cliff Shaw和Herbert A. Simon首次提出当时他们正在开发一种信息处理语言IPL。该IPL项目由美国兰德公司RAND Corporation资助。IPL随后被用于开发了几个早期的人工智能程序包括逻辑理论机Logic Theory Machine、通用问题求解器General Problem Solver和计算机下棋程序。
![](/api/attachments/169231)
1975年Newell和Simon被授予计算机领域的最高奖—图灵奖ACM Turing Award表彰他们“为人工智能、人类认知心理学以及链表处理做出了基础性贡献”。
#### 链表的适用范围和基本原理
现实世界中的大量数据都可以用链表来建模,但并不是所有类型的数据处理过程都适合用链表来实现。一般而言,适合用链表来表示和管理数据具有以下特点:
- 数据的数量是持续变化的
- 数据的数量上限难以估计,而且通常很大
- 不需要按照序号对数据进行随机访问
#### 链表的分类
- 单链表
单链表Singly Linked List是通过每个节点的指针指向下一个节点从而链接起来的链表结构最后一个节点的next指向null如下图。
![](/api/attachments/169232)
- 双链表
双链表Doubly Linked List是包含两个指针的pre指向前一个节点next指向后一个节点其中第一个节点head的pre指向null最后一个节点的tail指向null如下图。
![](/api/attachments/169233)
- 循环列表
循环链表Circular Linked List的全称是双向循环链表和双向链表的不同在于循环链表第一个节点的pre指向最后一个节点最后一个节点的next指向第一个节点形成一个“环”如下图。
![](/api/attachments/169234)
####链表与数组的对比
链表、数组和动态数组具有不同的内存管理方式。数组在内存中占用连续的内存空间,而链表则是每个节点占用一块空间。因此,滥用链表会导致内存碎片化问题。下图是链表、数组、动态数组之间的若干计算性质的对比:
![](/api/attachments/169235)
动态数组则是预先分配适量内存,后续使用过程不够时再重新分配更大的内存。但重新分配内存的过程往往会拷贝所有元素,代价较大。
链表是大家学习计算机编程、算法设计时经常用到的基本数据结构,完成了本次实训,大家将在这方面打下坚实的基础,非常有助于后续的提升。
#### 延伸阅读
* 马克•艾伦•维斯 (Mark Allen Weiss), 数据结构与算法分析:Java语言描述(原书第3版), 机械工业出版社, 2016年3月1日
* Wikipeida, Linked list https://en.wikipedia.org/wiki/Linked_list
* 张凌, 链表是做什么用的, 知乎, https://www.zhihu.com/question/19773378
','2018-02-07 17:03:17','2018-02-07 17:03:17'),
(5,'courseGuide','大家好!
欢迎进入在线课堂!
该课堂对应于一个或多个线下班级,课堂成员可以利用老师发布的邀请码申请加入。
在这里,老师和教辅将结合教学内容,把不同类型的实训项目发布给大家,让大家在真实的实战环境中得到锻炼。
那么什么是实训项目呢?大家有空自己尝试一下就知道了:
- Python实训[Python程序设计入门](https://www.educoder.net/paths/13) | [大学计算机基础——基于Python](https://www.educoder.net/paths/11)
- Java实训[Java语言程序设计基础篇](https://www.educoder.net/paths/38)
- C/C++实训:[C/C++程序设计](https://www.educoder.net/paths/3) | [数据结构与算法C语言](https://www.educoder.net/paths/4)
- Matlab实训[智取MATLAB基本语法](https://www.educoder.net/shixuns/7bvs54gw/challenges) | [控制结构](https://www.educoder.net/shixuns/q4fowkfa/challenges) | [矩阵进阶](https://www.educoder.net/shixuns/grunzcs3/challenges)
- HTML/CSS实训[HTML5+CSS3网页制作基础篇](https://www.educoder.net/paths/15)
- 云计算实训:[Docker企业级实训基础篇](https://www.educoder.net/paths/29)
... ... 等等
你们现在就可以去体验哦!
欢迎提出宝贵建议,平台一定会给您带来更多惊喜!
支持团队','2018-04-20 09:10:16','2018-04-20 09:10:16');
DROP TABLE IF EXISTS `edu_settings`;
CREATE TABLE `edu_settings` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(255) DEFAULT NULL,
`value` varchar(255) DEFAULT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
`description` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `index_edu_settings_on_name` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=utf8;
insert into `edu_settings`(`id`,`name`,`value`,`created_at`,`updated_at`,`description`) values
(1,'tomcat_webssh','http://172.16.94.254:8890','2019-06-21 09:38:31','2019-08-22 13:45:18',null),
(2,'webssh_username','root','2019-06-21 09:38:31','2019-06-21 10:29:51',null),
(3,'webssh_password','123123','2019-06-21 09:38:31','2019-06-21 10:30:02',null),
(4,'git_address_ip','http://172.16.95.5:9000','2019-06-21 09:38:31','2019-08-30 16:18:43',null),
(5,'git_address_domain','http://pre-git.educoder.net','2019-06-21 09:38:31','2019-08-30 16:18:32',null),
(6,'git_username','edugit','2019-06-21 09:38:31','2019-06-21 10:28:17',null),
(7,'git_password',' xinedugit#','2019-06-21 09:38:31','2019-06-21 10:28:26',null),
(8,'public_key','z7AAP5vtgm8UsbLIfbHodzb+iqH2vPz0sqK+jS4Kx7Nt9D6SgpLkKA==','2019-06-21 09:38:31','2019-06-26 10:01:20',null),
(9,'private_key','f3cb7907a54957953aebb32508b853934a9d3e91','2019-06-21 09:38:31','2019-06-26 10:01:34',null),
(10,'public_bucket','educoder','2019-06-21 09:38:31','2019-06-21 10:32:22',null),
(11,'public_bucket_host','https://pre-newweb.educoder.net','2019-06-21 09:38:31','2019-08-23 18:02:03',null),
(12,'public_cdn_host','','2019-06-21 09:38:31','2019-08-22 16:09:22',null),
(13,'cloud_bridge','http://172.16.94.254:8890','2019-06-21 09:38:31','2019-08-22 13:45:28',null),
(14,'cloud_tomcat_php','http://121.40.224.66','2019-06-21 09:38:31','2019-08-23 18:05:58',null),
(15,'host_name','http://pre-newweb.educoder.net','2019-06-21 09:38:31','2019-08-23 18:02:11',null),
(16,'old_edu_host','http://pre-oldweb.educoder.net','2019-06-21 09:38:31','2019-08-23 18:06:15',null),
(17,'bridge_secret_key','priEn3UwXfJs3PmyXnSG','2019-06-21 10:54:07','2019-06-21 10:54:07',null),
(18,'attachment_folder','/home/pdl/educoderplus/files','2019-06-21 10:54:34','2019-06-21 10:54:34',null),
(19,'cookie_domain','.educoder.net ','2019-06-21 10:54:50','2019-06-21 10:54:50',null),
(20,'openi_domain','https://openi.org.cn ','2019-06-21 10:55:39','2019-06-21 10:55:39',null),
(21,'sms_apikey','2affbf2ff83f9810512622ec83bccd4f','2019-06-21 10:56:22','2019-06-21 10:56:22',null),
(22,'educoder_domain','http://pre-newweb.educoder.net','2019-06-21 10:57:28','2019-08-23 18:02:22',null),
(23,'vnc_url','vnc.educoder.net','2019-06-22 17:53:54','2019-07-20 12:32:52',null),
(26,'review_server_url','http://172.16.94.186:80','2019-06-27 13:53:05','2019-08-09 10:37:52',null),
(27,'autologin_cookie_name','autologin_trustie','2019-07-22 10:16:27','2019-07-22 10:16:27',null),
(29,'notify_admin_phone','18711085785','2019-08-01 13:52:27','2019-08-01 13:52:27',null),
(30,'teacher_register_phone','17680641960','2019-08-01 16:16:17','2019-08-01 16:16:17',null),
(31,'subject_shixun_notify_phone','18711011226','2019-08-01 16:16:57','2019-08-01 16:16:57',null),
(32,'es_min_score','10','2019-08-02 08:51:17','2019-08-02 08:53:00',null);
SET FOREIGN_KEY_CHECKS = 1;