-- MySQL dump 10.13 Distrib 5.6.16, for debian-linux-gnu (x86_64) -- -- Host: rm-bp13v5020p7828r5r.mysql.rds.aliyuncs.com Database: educoderweb_test -- ------------------------------------------------------ -- Server version 5.6.16-log /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; SET @MYSQLDUMP_TEMP_LOG_BIN = @@SESSION.SQL_LOG_BIN; SET @@SESSION.SQL_LOG_BIN= 0; -- -- GTID state at the beginning of the backup -- SET @@GLOBAL.GTID_PURGED='4db4a28e-c3d6-11e9-9fe0-506b4bff4264:1-3881576'; -- -- Table structure for table `repertoires` -- DROP TABLE IF EXISTS `repertoires`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; 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; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `repertoires` -- LOCK TABLES `repertoires` WRITE; /*!40000 ALTER TABLE `repertoires` DISABLE KEYS */; INSERT INTO `repertoires` VALUES (1,'前端开发','2018-02-08 15:12:08','2019-09-02 15:24:19'),(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'); /*!40000 ALTER TABLE `repertoires` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `sub_repertoires` -- DROP TABLE IF EXISTS `sub_repertoires`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; 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; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `sub_repertoires` -- LOCK TABLES `sub_repertoires` WRITE; /*!40000 ALTER TABLE `sub_repertoires` DISABLE KEYS */; INSERT INTO `sub_repertoires` 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'); /*!40000 ALTER TABLE `sub_repertoires` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `tag_repertoires` -- DROP TABLE IF EXISTS `tag_repertoires`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; 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=169 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `tag_repertoires` -- LOCK TABLES `tag_repertoires` WRITE; /*!40000 ALTER TABLE `tag_repertoires` DISABLE KEYS */; INSERT INTO `tag_repertoires` 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,'MDL(Material 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','2019-09-02 15:20:54'),(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','2019-09-02 15:20:36'),(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','2019-08-28 16:58:13'),(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','2019-09-02 15:24:05'),(148,'其它',19,'2018-05-11 08:34:57','2019-09-02 15:20:38'),(151,'jQuery',1,'2018-05-11 09:20:15','2019-09-02 15:23:23'),(152,'C语言基础',29,'2018-05-11 09:26:55','2019-09-02 15:20:34'),(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'),(168,'计算机网络',19,'2019-08-31 10:27:52','2019-08-31 10:27:52'); /*!40000 ALTER TABLE `tag_repertoires` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `portal_images` -- DROP TABLE IF EXISTS `portal_images`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; 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; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `portal_images` -- LOCK TABLES `portal_images` WRITE; /*!40000 ALTER TABLE `portal_images` DISABLE KEYS */; INSERT INTO `portal_images` 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'); /*!40000 ALTER TABLE `portal_images` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `mirror_repositories` -- DROP TABLE IF EXISTS `mirror_repositories`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; 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=131 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `mirror_repositories` -- LOCK TABLES `mirror_repositories` WRITE; /*!40000 ALTER TABLE `mirror_repositories` DISABLE KEYS */; INSERT INTO `mirror_repositories` VALUES (2,'5d789e5d495f','python3-ssh:v1.0','1','python3.6.2,ssh;',1,'2018-01-29 11:31:25','2019-08-24 09:45:27','Python3.6','#!/bin/bash\ncd WORKSPACE\n\n#前台传来的可执行文件,即测试文件\nsourceClassNames=(SOURCECLASSNAMES)\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\n\n#不需要编译,设定编译结果为成功编译\ncompileResult=$(echo -n \"compile successfully\" | base64)\necho \'ulimit -f 10000\' >>/root/.bashrc ; source /root/.bashrc\n\nexecute(){\n executeCommand=\"python3.6 \"\n sourceClassName=${sourceClassNames[$1 - 1]}\n challengeStage=$1\n \n #get the loop times(looptimes = the num of testdataset)\n output=\'\'\n i=0\n while [[ i -lt ${#ins[*]} ]]; do\n #执行,并拼接执行结果\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\n #拼接输出结果\n output=$output\\\"$result\\\",\n let i++\n done\n output=\"[${output%?}]\"\n}\n\nexecute $1\n\n#return result in json format\nreturnResult(){\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output}\"\n echo $result\n}\n#拼装成最终的json格式,echo输出得到最后结果\nreturnResult\n\n',100000,2048,2,85,0,2,4),(3,'42bd3e1427cc','cisco-ssh:v1.0','1','dynagen0.11.0,dynamips0.2.8,ssh;',1,'2018-01-29 11:31:25','2019-08-20 15:45:53','Dynamips','#!/bin/bash\ncd WORKSPACE\n\n#前台传来的可执行文件,即测试文件\nsourceClassNames=(SOURCECLASSNAMES)\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\n\n#不需要编译,设定编译结果为成功编译\ncompileResult=$(echo -n \"compile successfully\" | base64)\n\n#echo \'ulimit -f 10000\' >>/root/.bashrc ; source /root/.bashrc\n\nexecute(){\n executeCommand=\"bash \"\n sourceClassName=${sourceClassNames[$1 - 1]}\n challengeStage=$1\n \n #get the loop times(looptimes = the num of testdataset)\n output=\'\'\n i=0\n while [[ i -lt ${#ins[*]} ]]; do\n #执行,并拼接执行结果\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\n #拼接输出结果\n output=$output\\\"$result\\\",\n let i++\n done\n output=\"[${output%?}]\"\n}\n\nexecute $1\n\n#return result in json format\nreturnResult(){\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output}\"\n echo $result\n}\n#拼装成最终的json格式,echo输出得到最后结果\nreturnResult\n\n',100000,1024,1,120,0,6,17),(4,'b21be9214e36','python2-ssh:v1.0','1','python2.7.9,ssh;',1,'2018-01-29 11:31:25','2019-08-20 15:47:45','Python2.7','#!/bin/bash\ncd WORKSPACE\n\n#前台传来的可执行文件,即测试文件\nsourceClassNames=(\"\" \"\" \"\")\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\n\n#不需要编译,设定编译结果为成功编译\ncompileResult=$(echo -n \"compile successfully\" | base64)\necho \'ulimit -f 10000\' >>/root/.bashrc ; source /root/.bashrc\n\nexecute(){\n executeCommand=\"python2.7 \"\n sourceClassName=${sourceClassNames[$1 - 1]}\n challengeStage=$1\n \n #get the loop times(looptimes = the num of testdataset)\n output=\'\'\n i=0\n while [[ i -lt ${#ins[*]} ]]; do\n #执行,并拼接执行结果\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\n #拼接输出结果\n output=$output\\\"$result\\\",\n let i++\n done\n output=\"[${output%?}]\"\n}\n\nexecute $1\n\n#return result in json format\nreturnResult(){\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output}\"\n echo $result\n}\n#拼装成最终的json格式,echo输出得到最后结果\nreturnResult\n\n',100000,1024,1,120,0,2,4),(5,'eb55c2848120','openjdk-ssh:v1.0','1','java1.8.0,zookeeper3.4.12;',1,'2018-01-29 11:31:25','2019-08-24 09:44:02','Java','#!/bin/bash\n#工作空间\ncd WORKSPACE\n#用户打开的文件名,之所以传过来这个,是因为可以从这个里面提取出来执行文件名\nchallengeProgramNames=(CHALLENGEPROGRAMNAMES)\n#执行文件名\nsourceClassNames=(SOURCECLASSNAMES)\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\n\n#限制每个shell连接所能写文件的最大容量,100M\necho \'ulimit -f 10000\' >>/root/.bashrc ; source /root/.bashrc\n\ncompile(){\n #编译命令,有的语言是没有编译过程,这个时候默认编译成功\n compileCommand=\"javac -encoding UTF-8 -Djava.ext.dirs=./lib/ -sourcepath src/ -d target/\"\n #取当前关卡的编译文件\n challengeProgramName=${challengeProgramNames[$1 - 1]}\n #当前关卡,作为参数传进来\n challengeStage=$1\n #删除上一次编译生成的文件,防止对本次编译造成影响\n rm -f ./target/step$challengeStage/*.class &> /dev/null\n \n # 获取编译结果(此处编译无输出则说明编译通过,否则输出编译错误信息,请按实训实际情况调整)\n compileResult=$($compileCommand $challengeProgramName 2>&1 | base64)\n if [ -z \"$compileResult\" ]; then\n compileResult=$(echo -n \"compile successfully\" | base64)\n fi\n\n}\ncompile $1\n\n\nexecute(){\n #执行命令\n executeCommand=\"java -Dfile.encoding=UTF-8 -Djava.ext.dirs=./lib/ -cp target/\"\n #执行文件名\n sourceClassName=${sourceClassNames[$1 - 1]}\n challengeStage=$1\n \n output=\'\'\n i=0\n while [[ i -lt ${#ins[*]} ]]; do\n #执行,并拼接执行结果\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\n #拼接输出结果\n output=$output\\\"$result\\\",\n let i++\n done\n output=\"[${output%?}]\"\n}\n\nexecute $1\n\n#return result in json format\nreturnResult(){\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output}\"\n echo $result\n}\n#拼装成最终的json格式,echo输出得到最后结果\nreturnResult\n\n',100000,1024,1,50,1,2,4),(6,'3a0adda6b05f','hive-ssh:v1.0','1','hive-2.3.2,ssh;',1,'2018-01-29 11:31:25','2019-08-24 09:45:01','Hive',NULL,100000,2500,2,120,0,5,14),(7,'c3cac044d76a','hadoop-ssh:v1.0','1','jdk8,ant1.10.1,hadoop2.7.4,ssh; 伪分布式',1,'2018-01-29 11:31:25','2019-08-20 15:46:13','Hadoop','#!/bin/bash\n#工作空间\ncd WORKSPACE\n#用户打开的文件名,之所以传过来这个,是因为可以从这个里面提取出来执行文件名\nchallengeProgramNames=(CHALLENGEPROGRAMNAMES)\n#执行文件名\nsourceClassNames=(SOURCECLASSNAMES)\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\n#限制每个shell连接所能写文件的最大容量,100M\necho \'ulimit -f 10000\' >>/root/.bashrc ; source /root/.bashrc\n\ncompile(){\n cd step$1\n #编译命令,有的语言是没有编译过程,这个时候默认编译成功\n compileCommand=\"/apache-ant-1.10.1/bin/ant -q -S\"\n #取当前关卡的编译文件\n challengeProgramName=${challengeProgramNames[$1 - 1]}\n #当前关卡,作为参数传进来\n challengeStage=$1\n############################################\n\n compileResult=$($compileCommand 2>&1)\n echo $compileResult |grep \'BUILD FAILED\' >/dev/null\n if [[ $? == 0 ]]; then\n compileResult=$(echo -n $compileResult | base64)\n else\n compileResult=$(echo -n \"compile successfully\" | base64)\n fi\n\n}\ncompile $1\n\n\nexecute(){\n #执行命令\n executeCommand=\"sh $1.sh\"\n #执行文件名\n sourceClassName=${sourceClassNames[$1 - 1]}\n challengeStage=$1\n output=\'\'\n i=0\n while [[ i -lt ${#ins[*]} ]]; do\n #执行,并拼接执行结果\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\n #拼接输出结果\n output=$output\\\"$(cat /tmp/output/part-r-00000 2>/dev/null | base64)\\\",\n let i++\n done\n output=\"[${output%?}]\"\n}\n\nexecute $1\n\n#return result in json format\nreturnResult(){\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output}\"\n echo $result\n}\n#拼装成最终的json格式,echo输出得到最后结果\nreturnResult\n\n',100000,2048,1,120,1,5,14),(8,'a48703cc8a4b','sdl2-vnc:v1.0','1','sdl2,vnc,ssh;',1,'2018-01-29 11:31:25','2019-08-20 15:46:51','SDL',NULL,100000,1024,1,120,1,2,NULL),(9,'6293d9c4ae5b','php-ssh:v1.0','1','php7.1.10,ssh;',1,'2018-01-29 11:31:25','2019-08-20 15:47:31','PHP','#!/bin/bash\ncd WORKSPACE\n\n#前台传来的可执行文件,即测试文件\nsourceClassNames=(\"src/step1/SafeDataFillingTest.php\" \"src/step2/RequiredFieldsTest.php\" \"src/step3/ValidationOfLegitimacyTest.php\" \"src/step4/FormDemoTest.php\")\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\n\n#不需要编译,设定编译结果为成功编译\ncompileResult=$(echo -n \"compile successfully\" | base64)\necho \'ulimit -f 10000\' >>/root/.bashrc ; source /root/.bashrc\n\n#启动php自建web服务器,端口为80\nrunserver(){\n count=`ps -ef | grep php | grep -v grep | wc -l`\n if [ 0 -eq $count ]; then\n nohup php -S 0.0.0.0:8080 &> /dev/null &\n fi\n}\nrunserver\n\nexecute(){\n executeCommand=\"php\"\n sourceClassName=${sourceClassNames[$1 - 1]}\n challengeStage=$1\n\n #get the loop times(looptimes = the num of testdataset)\n output=\'\'\n i=0\n while [[ i -lt ${#ins[*]} ]]; do\n #执行,并拼接执行结果\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\n #拼接输出结果\n output=$output\\\"$result\\\",\n let i++\n done\n output=\"[${output%?}]\"\n}\n\nexecute $1\n\n#return result in json format\nreturnResult(){\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output}\"\n echo $result\n}\n#拼装成最终的json格式,echo输出得到最后结果\nreturnResult\n\n',100000,1024,1,120,0,2,4),(10,'2f0657d8af26','octave-novnc:v1.0','1','octave4.2.1,novnc;',1,'2018-01-29 11:31:25','2019-08-24 09:44:14','Matlab','#!/bin/bash\ncd WORKSPACE\n\n#前台传来的可执行文件,即测试文件\nsourceClassNames=(\"step1/f_t_1_c.m\" \"step2/f_t_2.m\")\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\n\n#不需要编译,设定编译结果为成功编译\ncompileResult=$(echo -n \"compile successfully\" | base64)\necho \'ulimit -f 10000\' >>/root/.bashrc ; source /root/.bashrc\n\nexecute(){\n executeCommand=\"octave \"\n sourceClassName=${sourceClassNames[$1 - 1]}\n challengeStage=$1\n \n #get the loop times(looptimes = the num of testdataset)\n output=\'\'\n i=0\n while [[ i -lt ${#ins[*]} ]]; do\n #执行,并拼接执行结果\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 |grep -vE \"warning: function|octave: unable|octave: disabling\" | base64)\n #拼接输出结果\n output=$output\\\"$result\\\",\n let i++\n done\n output=\"[${output%?}]\"\n}\n\nexecute $1\n\n#return result in json format\nreturnResult(){\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output}\"\n echo $result\n}\n#拼装成最终的json格式,echo输出得到最后结果\nreturnResult\n\n',100000,2048,1,120,0,8,19),(12,'c64a7e3a4b1c','git-ssh:v1.0','1','git2.1.4,ssh;',1,'2018-01-29 11:31:25','2019-08-20 15:46:03','Git','#!/bin/bash\ncd WORKSPACE\n\n#前台传来的可执行文件,即测试文件\nsourceClassNames=(SOURCECLASSNAMES)\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\n\n#不需要编译,设定编译结果为成功编译\ncompileResult=$(echo -n \"compile successfully\" | base64)\necho \'ulimit -f 10000\' >>/root/.bashrc ; source /root/.bashrc\n\nexecute(){\n executeCommand=\"python \"\n sourceClassName=${sourceClassNames[$1 - 1]}\n challengeStage=$1\n \n #get the loop times(looptimes = the num of testdataset)\n output=\'\'\n i=0\n while [[ i -lt ${#ins[*]} ]]; do\n #执行,并拼接执行结果\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\n #拼接输出结果\n output=$output\\\"$result\\\",\n let i++\n done\n output=\"[${output%?}]\"\n}\n\nexecute $1\n\n#return result in json format\nreturnResult(){\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output}\"\n echo $result\n}\n#拼装成最终的json格式,echo输出得到最后结果\nreturnResult\n\n',100000,1024,1,120,0,6,16),(13,'e19fc2ec6bb8','gcc-ssh:v1.0','1','gcc7.2.0,boost1.66.0,opencv3.4.1,ssh;',1,'2018-01-29 11:31:25','2019-06-25 14:19:52','C/C++','#!/bin/bash\ncd WORKSPACE\n\nchallengeProgramNames=(\"src/step1/test.cpp\")\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\n\necho \'ulimit -f 1000000\' >>/root/.bashrc ; source /root/.bashrc\n\ncompile(){\n compileCommand=\"g++ \"\n challengeProgramName=${challengeProgramNames[$1 - 1]}\n #remove the executeFile.out file that last time remains\n rm -f ./executeFile.out &> /dev/null\n\n #compile all .c file in the source folder: a/b/c.cpp --> a/b/*.cpp\n challengeProgramName=${challengeProgramName%/*.cpp}\"/*.cpp\"\n\n # 获取编译结果(此处编译无输出则说明编译通过,否则输出编译错误信息,请按实训实际情况调整)\n compileResult=$($compileCommand $challengeProgramName -o executeFile.out 2>&1 | base64)\n if [ -z \"$compileResult\" ]; then\n compileResult=$(echo -n \"compile successfully\" | base64)\n fi\n\n}\ncompile $1\n\n\nexecute(){\n executeCommand=\"./executeFile.out\"\n challengeStage=$1\n \n #get the loop times(looptimes = the num of testdataset)\n output=\'\'\n i=0\n while [[ i -lt ${#ins[*]} ]]; do\n #执行,并拼接执行结果\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand | base64)\n #拼接输出结果\n output=$output\\\"$result\\\",\n let i++\n done\n output=\"[${output%?}]\"\n}\n\nexecute $1\n\n#return result in json format\nreturnResult(){\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output}\"\n echo $result\n}\n#拼装成最终的json格式,echo输出得到最后结果\nreturnResult\n\n',100000,1024,1,40,1,2,4),(14,'f953dd677e85','ruby-ssh:v1.0','1','ruby2.3.1,rails5.2.0,ssh;',1,'2018-01-29 11:31:25','2019-08-20 15:46:45','Ruby','#!/bin/bash\ncd WORKSPACE\n\n#前台传来的可执行文件,即测试文件\nsourceClassNames=(\"\")\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\n\n#不需要编译,设定编译结果为成功编译\ncompileResult=$(echo -n \"compile successfully\" | base64)\necho \'ulimit -f 10000\' >>/root/.bashrc ; source /root/.bashrc\n\nexecute(){\n executeCommand=\"ruby \"\n sourceClassName=${sourceClassNames[$1 - 1]}\n challengeStage=$1\n \n #get the loop times(looptimes = the num of testdataset)\n output=\'\'\n i=0\n while [[ i -lt ${#ins[*]} ]]; do\n #执行,并拼接执行结果\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\n #拼接输出结果\n output=$output\\\"$result\\\",\n let i++\n done\n output=\"[${output%?}]\"\n}\n\nexecute $1\n\n#return result in json format\nreturnResult(){\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output}\"\n echo $result\n}\n#拼装成最终的json格式,echo输出得到最后结果\nreturnResult\n\n',100000,1024,1,120,0,2,NULL),(15,'e56c4315f99c','ubuntu16-ssh:v1.0','1','ubuntu16.04,ssh;',1,'2018-01-29 11:31:25','2019-08-20 15:46:56','Shell','#!/bin/bash\ncd WORKSPACE\n\n#前台传来的可执行文件,即测试文件\nsourceClassNames=(\"\" \"\" \"\" \"\" \"\" \"\")\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\n\n#不需要编译,设定编译结果为成功编译\ncompileResult=$(echo -n \"compile successfully\" | base64)\necho \'ulimit -f 10000\' >>/root/.bashrc ; source /root/.bashrc\n\nexecute(){\n executeCommand=\"bash \"\n sourceClassName=${sourceClassNames[$1 - 1]}\n challengeStage=$1\n \n #get the loop times(looptimes = the num of testdataset)\n output=\'\'\n i=0\n while [[ i -lt ${#ins[*]} ]]; do\n #执行,并拼接执行结果\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\n #拼接输出结果\n output=$output\\\"$result\\\",\n let i++\n done\n output=\"[${output%?}]\"\n}\n\nexecute $1\n\n#return result in json format\nreturnResult(){\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output}\"\n echo $result\n}\n#拼装成最终的json格式,echo输出得到最后结果\nreturnResult\n\n',100000,1024,1,120,0,6,16),(16,'316a8a646cdb','node-ssh:v1.0','1','node9.3.0,python2,python3,htmlhint0.9.13,csslint1.0.4,ssh;',1,'2018-01-29 11:31:25','2019-08-20 15:46:36','JavaScript','#!/bin/bash\ncd WORKSPACE\n\n#前台传来的可执行文件,即测试文件\nsourceClassNames=(\"\" \"\" \"VariableTest.py\")\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\n\n#不需要编译,设定编译结果为成功编译\ncompileResult=$(echo -n \"compile successfully\" | base64)\necho \'ulimit -f 10000\' >>/root/.bashrc ; source /root/.bashrc\n\nexecute(){\n executeCommand=\"node \"\n sourceClassName=${sourceClassNames[$1 - 1]}\n challengeStage=$1\n \n #get the loop times(looptimes = the num of testdataset)\n output=\'\'\n i=0\n while [[ i -lt ${#ins[*]} ]]; do\n #执行,并拼接执行结果\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\n #拼接输出结果\n output=$output\\\"$result\\\",\n let i++\n done\n output=\"[${output%?}]\"\n}\n\nexecute $1\n\n#return result in json format\nreturnResult(){\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output}\"\n echo $result\n}\n#拼装成最终的json格式,echo输出得到最后结果\nreturnResult\n\n',100000,1024,1,120,0,1,1),(17,'6e04f44485a9','perl6-ssh:v1.0','1','perl6,ssh;',1,'2018-01-29 11:31:25','2019-08-20 15:47:27','Perl6','#!/bin/bash\ncd WORKSPACE\n\n#前台传来的可执行文件,即测试文件\nsourceClassNames=(\"src/step1/first.pl\" \"\")\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\n\n#不需要编译,设定编译结果为成功编译\ncompileResult=$(echo -n \"compile successfully\" | base64)\necho \'ulimit -f 10000\' >>/root/.bashrc ; source /root/.bashrc\n\nexecute(){\n executeCommand=\"perl6 \"\n sourceClassName=${sourceClassNames[$1 - 1]}\n challengeStage=$1\n \n #get the loop times(looptimes = the num of testdataset)\n output=\'\'\n i=0\n while [[ i -lt ${#ins[*]} ]]; do\n #执行,并拼接执行结果\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\n #拼接输出结果\n output=$output\\\"$result\\\",\n let i++\n done\n output=\"[${output%?}]\"\n}\n\nexecute $1\n\n#return result in json format\nreturnResult(){\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output}\"\n echo $result\n}\n#拼装成最终的json格式,echo输出得到最后结果\nreturnResult\n\n',100000,1024,1,120,0,2,NULL),(18,'4e82c3efd0fb','kotlin-ssh:v1.0','1','kotlin1.2.20,ssh;',1,'2018-01-29 11:31:25','2019-08-20 15:46:47','Kotlin','#!/bin/bash\n#工作空间\ncd WORKSPACE\n#用户打开的文件名,之所以传过来这个,是因为可以从这个里面提取出来执行文件名\nchallengeProgramNames=(\"src/step1/first.kt\" \"\")\n#执行文件名\nsourceClassNames=(\"step1.first\" \"\")\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\n\n#限制每个shell连接所能写文件的最大容量,100M\necho \'ulimit -f 10000\' >>/root/.bashrc ; source /root/.bashrc\n\ncompile(){\n compileCommand=\"kotlinc -include-runtime -d mainfun.jar\"\n #取当前关卡的编译文件\n challengeProgramName=${challengeProgramNames[$1 - 1]}\n #当前关卡,作为参数传进来\n challengeStage=$1\n #删除上一次编译生成的文件,防止对本次编译造成影响\n rm -f ./target/step$challengeStage/*.class &> /dev/null\n\n # 获取编译结果(此处编译无输出则说明编译通过,否则输出编译错误信息,请按实训实际情况调整)\n compileResult=$($compileCommand $challengeProgramName 2>&1 | base64)\n if [ -z \"$compileResult\" ]; then\n compileResult=$(echo -n \"compile successfully\" | base64)\n fi\n\n}\ncompile $1\n\n\nexecute(){\n #执行命令\n executeCommand=\"java -jar mainfun.jar\"\n #执行文件名\n sourceClassName=${sourceClassNames[$1 - 1]}\n challengeStage=$1\n\n output=\'\'\n i=0\n while [[ i -lt ${#ins[*]} ]]; do\n #执行,并拼接执行结果\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\n #拼接输出结果\n output=$output\\\"$result\\\",\n let i++\n done\n output=\"[${output%?}]\"\n}\n\nexecute $1\n\n#return result in json format\nreturnResult(){\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output}\"\n echo $result\n}\n#拼装成最终的json格式,echo输出得到最后结果\nreturnResult\n\n',100000,1024,1,120,1,2,NULL),(19,'2de19c574588','elixir-ssh:v1.0','1','elixir1.5.3,ssh;\r\n',1,'2018-01-29 11:31:25','2019-08-20 15:45:56','Elixir',NULL,100000,1024,1,120,0,2,NULL),(20,'a0067972d5d8','android:v1.0','1','jdk7,jdk8,android-sdk;',1,'2018-01-29 11:31:25','2019-08-20 15:43:33','Android','#!/bin/bash\n#工作空间\ncd WORKSPACE\n#用户打开的文件名,之所以传过来这个,是因为可以从这个里面提取出来执行文件名\nchallengeProgramNames=(\"step1/makefile.py\" \"\" \"\")\n#执行文件名\nsourceClassNames=(\"makefile\" \"\" \"\")\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\n#不需要编译,设定编译结果为成功编译\ncompileResult=$(echo -n \"compile successfully\" | base64)\n#限制每个shell连接所能写文件的最大容量,100M\necho \'ulimit -f 10000\' >>/root/.bashrc ; source /root/.bashrc\n\n\n\nexecute(){\n #执行命令\n executeCommand=\"python makefile.py\"\n #执行文件名\n sourceClassName=${sourceClassNames[$1 - 1]}\n challengeStage=$1\n output=\'\'\n i=0\n while [[ i -lt ${#ins[*]} ]]; do\n #执行,并拼接执行结果\n cd step$1\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand 2>&1 | base64)\n #拼接输出结果\n output=$output\\\"$result\\\",\n let i++\n done\n output=\"[${output%?}]\"\n}\n\nexecute $1\n\n#return result in json format\nreturnResult(){\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output}\"\n echo \"$result\"\n}\n#拼装成最终的json格式,echo输出得到最后结果\nreturnResult\n\n',100000,1024,1,120,0,3,5),(21,'21bf72b5e23e','ubuntu16-xfce-vnc:v1.0','0','VNC图形化镜像',1,'2018-01-29 11:31:25','2019-08-20 15:45:35','VNC',NULL,100000,1024,1,120,0,6,17),(22,'30f82079d643','jfinal-mysql55:v1.0','1','tomcat8.5.20,mysql5.5,jdk1.8,ant1.10.1,maven3.5.4;',1,'2018-01-29 11:31:25','2019-08-28 16:05:17','JavaWeb','#!/bin/bash\ncd WORKSPACEjfinalshop\n\nsourceClassNames=(\"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\")\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\n\necho \'ulimit -f 1000000\' >>/root/.bashrc ; source /root/.bashrc\n\nrestartTomcat(){\n bash /home/apache-tomcat-8.5.20/bin/shutdown.sh &> /dev/null\n bash /home/apache-tomcat-8.5.20/bin/startup.sh &> /dev/null\n while :;\n do\n sleep 1\n cat /home/apache-tomcat-8.5.20/logs/catalina.out| tail -20 | grep \'startup in\' &> /dev/null\n if [ $? -eq 0 ]\n then\n break\n fi\n done\n}\n\ncompile(){\n compileCommand=\"ant -q -S\"\n\n compileResult=$($compileCommand 2>&1)\n failedInfo=\"BUILD FAILED\"\n if [[ $compileResult == *$failedInfo* ]]; then\n compileResult=$(echo -n $compileResult | base64)\n else\n compileResult=$(echo -n \"compile successfully\" | base64)\n\n restartTomcat\n fi\n}\n\ncompile $1\n\nexecute(){\n executeCommand=\"java -Dfile.encoding=UTF-8 -Djava.ext.dirs=../../WebRoot/WEB-INF/lib \"\n sourceClassName=${sourceClassNames[$1 - 1]}\n challengeStage=$1\n\n #get the loop times(looptimes = the num of testdataset)\n output=\'\'\n i=0\n while [[ i -lt ${#ins[*]} ]]; do\n #执行,并拼接执行结果\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\n #拼接输出结果\n output=$output\\\"$result\\\",\n let i++\n done\n output=\"[${output%?}]\"\n}\n\nexecute $1\n\n#return result in json format\nreturnResult(){\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output}\"\n echo $result\n}\n#拼装成最终的json格式,echo输出得到最后结果\nreturnResult\n\n',100000,1024,1,180,0,1,2),(24,'833b45fe4ce5','go-ssh:v1.0','1','go1.9.2,ssh;',1,'2018-01-29 11:31:25','2019-08-20 15:46:07','Go','#!/bin/bash\ncd WORKSPACE\n\n#前台传来的可执行文件,即测试文件\nsourceClassNames=(\"step1/devide.go\" \"step2/panic-recover.go\" \"step3/defertest.go\")\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\n\n#不需要编译,设定编译结果为成功编译\ncompileResult=$(echo -n \"compile successfully\" | base64)\necho \'ulimit -f 10000\' >>/root/.bashrc ; source /root/.bashrc\n\nexecute(){\n executeCommand=\"go run \"\n sourceClassName=${sourceClassNames[$1 - 1]}\n challengeStage=$1\n\n #get the loop times(looptimes = the num of testdataset)\n output=\'\'\n i=0\n while [[ i -lt ${#ins[*]} ]]; do\n #执行,并拼接执行结果\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\n #拼接输出结果\n output=$output\\\"$result\\\",\n let i++\n done\n output=\"[${output%?}]\"\n}\n\nexecute $1\n\n#return result in json format\nreturnResult(){\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output}\"\n echo $result\n}\n#拼装成最终的json格式,echo输出得到最后结果\nreturnResult\n\n',100000,1024,1,120,0,2,NULL),(27,'7a7980335112','mysql55-ssh:v1.0','0','mysql5.5,ssh;',1,'2018-01-29 11:31:25','2019-08-20 15:45:51','Mysql',NULL,100000,1024,1,120,0,4,9),(29,'d3d83a78ed87','spark-ssh:v1.0','1','jdk8,maven3.5.0,ssh;',1,'2018-01-29 11:31:25','2019-08-24 09:45:33','Spark',NULL,100000,2048,1,180,0,5,14),(30,'f0d5bfc8134e','machine-learning:v1.0','1','python2.7.9,python3.6.2,jdk8,ssh;',1,'2018-01-29 11:31:25','2019-08-20 15:46:52','MachineLearning','#!/bin/bash\ncd WORKSPACE\n\n#前台传来的可执行文件,即测试文件\nsourceClassNames=(SOURCECLASSNAMES)\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\n\necho \'ulimit -f 10000\' >>/root/.bashrc ; source /root/.bashrc\n\n#不需要编译,设定编译结果为成功编译\ncompileResult=$(echo -n \"compile successfully\" | base64)\n\nexecute(){\n executeCommand=\"python \"\n sourceClassName=${sourceClassNames[$1 - 1]}\n challengeStage=$1\n \n #get the loop times(looptimes = the num of testdataset)\n output=\'\'\n i=0\n while [[ i -lt ${#ins[*]} ]]; do\n #执行,并拼接执行结果\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\n #拼接输出结果\n output=$output\\\"$result\\\",\n let i++\n done\n output=\"[${output%?}]\"\n}\n\nexecute $1\n\n#return result in json format\nreturnResult(){\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output}\"\n echo $result\n}\n#拼装成最终的json格式,echo输出得到最后结果\nreturnResult\n\n',100000,1024,1,180,0,5,12),(32,'c3f1760586db','iverilog-ssh:v1.0','1','verilog0.10.0,ssh;',1,'2018-01-29 11:31:25','2019-08-20 15:46:05','Verilog','#!/bin/bash\ncd WORKSPACE\n\nchallengeProgramNames=(\"\" \"\")\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\n\necho \'ulimit -f 1000000\' >>/root/.bashrc ; source /root/.bashrc\n\ncompile(){\n compileCommand=\"iverilog \"\n challengeProgramName=${challengeProgramNames[$1 - 1]}\n #remove the executeFile.out file that last time remains\n rm -f ./executeFile.out &> /dev/null\n\n # 获取编译结果(此处编译无输出则说明编译通过,否则输出编译错误信息,请按实训实际情况调整)\n compileResult=$($compileCommand $challengeProgramName -o executeFile.out 2>&1 | base64)\n if [ -z \"$compileResult\" ]; then\n compileResult=$(echo -n \"compile successfully\" | base64)\n fi\n}\ncompile $1\n\n\nexecute(){\n executeCommand=\"vvp \"\n challengeStage=$1\n\n #get the loop times(looptimes = the num of testdataset)\n output=\'\'\n i=0\n while [[ i -lt ${#ins[*]} ]]; do\n #执行,并拼接执行结果\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand executeFile.out 2>&1 | base64)\n #拼接输出结果\n output=$output\\\"$result\\\",\n let i++\n done\n output=\"[${output%?}]\"\n}\n\nexecute $1\n\n#return result in json format\nreturnResult(){\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output}\"\n echo $result\n}\n#拼装成最终的json格式,echo输出得到最后结果\nreturnResult\n\n',100000,1024,1,120,1,8,19),(34,'14a2cc7affa2','dind-ssh:v1.0','1','docker17.06.0-ce,ssh;',1,'2018-01-29 11:31:25','2019-08-20 15:45:49','Docker','#!/bin/bash\ncd WORKSPACE\n\n#前台传来的可执行文件,即测试文件\nsourceClassNames=(\"\")\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\n\n#不需要编译,设定编译结果为成功编译\ncompileResult=$(echo -n \"compile successfully\" | base64)\n\necho \'ulimit -f 10000\' >>/root/.bashrc ; source /root/.bashrc\n\nexecute(){\n executeCommand=\"bash \"\n sourceClassName=${sourceClassNames[$1 - 1]}\n challengeStage=$1\n \n #get the loop times(looptimes = the num of testdataset)\n output=\'\'\n i=0\n while [[ i -lt ${#ins[*]} ]]; do\n #执行,并拼接执行结果\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\n #拼接输出结果\n output=$output\\\"$result\\\",\n let i++\n done\n output=\"[${output%?}]\"\n}\n\nexecute $1\n\n#return result in json format\nreturnResult(){\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output}\"\n echo $result\n}\n#拼装成最终的json格式,echo输出得到最后结果\nreturnResult\n\n',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.7,ssh;',1,'2018-01-29 16:11:33','2019-08-20 15:44:57','C#',NULL,100000,1024,1,120,1,2,NULL),(64,'d9c6e8954dad','sqlite-ssh:v1.0','1','sqlite3.11.0,ssh;',1,'2018-03-06 14:03:48','2019-08-20 15:47:08','SQLite3',NULL,100000,1024,1,120,NULL,NULL,NULL),(66,'fbaeac72b706','oracle-ssh:v1.0','1','oracle11.2.0.2.0,ssh;',1,'2018-03-29 15:18:41','2019-08-20 15:47:14','Oracle',NULL,100000,800,1,240,NULL,NULL,NULL),(94,'1ed037bbd23f','ghdl-ssh:v1.0','1','ghdl-0.36-dev,gnat-5.4.0,ssh;',1,'2018-04-04 17:21:04','2019-08-20 15:45:45','Vhdl',NULL,100000,1024,1,120,NULL,NULL,NULL),(95,'46198ab247fb','r-ssh:v1.0','1','R-3.4.4,ssh;',1,'2018-04-08 10:30:37','2019-08-20 15:46:41','R',NULL,100000,1024,1,120,NULL,NULL,NULL),(96,'ea8282136791','swift-ssh:v1.0','1','swift-4.1,ssh;',1,'2018-04-09 15:13:06','2019-08-20 15:46:15','Swift',NULL,100000,1024,1,120,NULL,NULL,NULL),(97,'5d4e4884482c','sqlserver-ssh:v1.0','1','sqlserver2017,ssh;',1,'2018-04-26 11:55:21','2019-08-20 15:47:15','SQLServer',NULL,100000,2000,1,120,NULL,NULL,NULL),(98,'714ba67fe884','mysqlserver55-ssh:v1.0','1','mysql5.5,ssh;',1,'2018-05-10 09:40:08','2019-08-24 09:45:13','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-08-20 15:46:09','Ubuntu16-env',NULL,1000000,2560,1,120,NULL,NULL,NULL),(104,'24b3af129b64','mongo-ssh:v1.0','1','mogo4.0,python3,ssh;',1,'2018-08-02 15:31:23','2019-08-20 15:47:07','Mongo',NULL,100000,1024,1,120,NULL,NULL,NULL),(105,'3614e492d7e9','mongodb-ssh:v1.0','0','mogo4.0,python3,ssh;',1,'2018-08-20 15:39:41','2019-08-20 15:45:56','Mogodb',NULL,100000,1024,1,120,NULL,NULL,NULL),(106,'01ed95c29336','python3-vnc:v1.0','1','turtle库,python3.5,vnc;',1,'2018-09-06 11:32:52','2019-08-20 15:46:29','Python3-vnc',NULL,100000,1024,1,120,NULL,NULL,NULL),(107,'744ae213d094','python3-competition:v1.0','1','没有安装sklearn包;',1,'2018-10-29 10:23:30','2019-08-31 16:43:26','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-08-20 15:46:17','Hbase',NULL,100000,3096,2,200,NULL,NULL,NULL),(109,'f890a121e481','postgresql-ssh:v1.0','1','postgresql9.5.14,ssh;',1,'2018-11-15 12:15:17','2019-08-20 15:47:36','PostgreSql',NULL,100000,1024,1,120,NULL,NULL,NULL),(110,'bd62c3d558cd','hbase2-ssh:v1.0','1','为分部署定制的镜像。',1,'2018-11-18 15:27:27','2019-08-20 15:46:26','Hbase2',NULL,100000,4048,1,120,NULL,NULL,NULL),(111,'fa6acf79f4c2','hbase-simple:v1.0','1','单节点',1,'2018-11-30 15:10:54','2019-08-24 09:45:19','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-08-20 15:46:24','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-08-20 15:47:10','Nasm',NULL,100000,1024,1,120,NULL,NULL,NULL),(115,'6f3c7e80aeea','ubuntu-nvidia:v1.0','1','GPU',1,'2019-03-07 14:32:45','2019-08-24 09:47:22','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-08-20 15:47:53','Python3-tentensorflow1.5',NULL,100000,2048,1,120,NULL,NULL,NULL),(118,'53ffa15bc4ec','kafka-ssh:v1.0','1','kafka_2.11-1.1.0,afka_2.11-1.1.0,ssh,mvn;',1,'2019-03-20 17:33:46','2019-08-24 09:44:08','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-08-24 09:45:42','VSCode',NULL,100000,2048,1,120,NULL,NULL,NULL),(120,'45221690780b','ubuntu-nvidia-c:v1.0','1','cuda、mpi;',1,'2019-06-05 17:46:20','2019-08-24 09:47:31','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-08-24 09:43:36','Flink',NULL,100000,3072,1,120,NULL,NULL,NULL),(124,'bdfb097d9a30','matlab-novnc:v1.0','1','matlab2017图形化:',1,'2019-06-25 13:29:14','2019-08-24 09:45:08','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-08-24 09:43:24','Cisco',NULL,100000,1024,1,120,NULL,NULL,NULL),(129,'3b128da61027','hbase-finish-ssh:v1.0','1','hbase 2.0.0',1,'2019-08-13 16:30:16','2019-08-31 09:30:58','Hbase-finish',NULL,100000,2048,1,120,NULL,NULL,NULL),(130,'9f0d7f24c276','hbase-nobug-ssh:v1.0','1','无自启',1,'2019-08-30 16:40:21','2019-08-31 15:57:03','Hbase-nobug',NULL,10000,1024,1,120,NULL,NULL,NULL); /*!40000 ALTER TABLE `mirror_repositories` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `mirror_scripts` -- DROP TABLE IF EXISTS `mirror_scripts`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; 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=91 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `mirror_scripts` -- LOCK TABLES `mirror_scripts` WRITE; /*!40000 ALTER TABLE `mirror_scripts` DISABLE KEYS */; INSERT INTO `mirror_scripts` VALUES (1,13,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\nchallengeProgramNames=(CHALLENGEPROGRAMNAMES)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\necho \'ulimit -f 1000000\' >>/root/.bashrc ; source /root/.bashrc\r\n\r\ncompile(){\r\n compileCommand=\"gcc -lm -lc -lz \"\r\n challengeProgramName=${challengeProgramNames[$1 - 1]}\r\n #remove the executeFile.out file that last time remains\r\n rm -f ./executeFile.out &> /dev/null\r\n\r\n #compile all .c file in the source folder: a/b/c.c --> a/b/*.c\r\n challengeProgramName=${challengeProgramName%/*.c}\"/*.c\"\r\n\r\n # 获取编译结果(此处编译无输出则说明编译通过,否则输出编译错误信息,请按实训实际情况调整)\r\n compileResult=$($compileCommand $challengeProgramName -o executeFile.out 2>&1 | base64)\r\n if [ -z \"$compileResult\" ]; then\r\n compileResult=$(echo -n \"compile successfully\" | base64)\r\n fi\r\n\r\n}\r\ncompile $1\r\n\r\n\r\nexecute(){\r\n executeCommand=\"./executeFile.out\"\r\n challengeStage=$1\r\n \r\n #get the loop times(looptimes = the num of testdataset)\r\n res_usage=\"{\\\"testSetUsages\\\":[\"\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes\r\n startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n #执行,并拼接执行结果\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand | base64)\r\n #拼接输出结果\r\n endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n let testSetCpuUsage=$endCpuUsage-$startCpuUsage\r\n maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)\r\n res_usage=\"$res_usage{\\\"testSetTime\\\":\\\"$testSetCpuUsage\\\",\\\"testSetMem\\\":\\\"$maxMemUsage\\\"},\"\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\n\r\nexecute $1\r\nres_usage=\"${res_usage::-1}\"\r\nres_usage=\"$res_usage]}\"\r\nres_usage=$(echo -ne \"$res_usage\"|base64)\r\n#return result in json format\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output,\\\"resUsage\\\":\\\"$res_usage\\\"}\"\r\n echo $result\r\n}\r\n#拼装成最终的json格式,echo输出得到最后结果\r\nreturnResult\r\n\r\n','C','C标准脚本','2018-01-29 14:43:15','2019-07-19 13:53:37'),(2,13,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\nchallengeProgramNames=(CHALLENGEPROGRAMNAMES)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\necho \'ulimit -f 1000000\' >>/root/.bashrc ; source /root/.bashrc\r\n\r\ncompile(){\r\n compileCommand=\"g++ \"\r\n challengeProgramName=${challengeProgramNames[$1 - 1]}\r\n #remove the executeFile.out file that last time remains\r\n rm -f ./executeFile.out &> /dev/null\r\n\r\n #compile all .c file in the source folder: a/b/c.cpp --> a/b/*.cpp\r\n challengeProgramName=${challengeProgramName%/*.cpp}\"/*.cpp\"\r\n\r\n # 获取编译结果(此处编译无输出则说明编译通过,否则输出编译错误信息,请按实训实际情况调整)\r\n compileResult=$($compileCommand $challengeProgramName -o executeFile.out 2>&1 | base64)\r\n if [ -z \"$compileResult\" ]; then\r\n compileResult=$(echo -n \"compile successfully\" | base64)\r\n fi\r\n\r\n}\r\ncompile $1\r\n\r\n\r\nexecute(){\r\n executeCommand=\"./executeFile.out\"\r\n challengeStage=$1\r\n \r\n #get the loop times(looptimes = the num of testdataset)\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n #执行,并拼接执行结果\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand | base64)\r\n #拼接输出结果\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\n\r\nexecute $1\r\n\r\n#return result in json format\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output}\"\r\n echo $result\r\n}\r\n#拼装成最终的json格式,echo输出得到最后结果\r\nreturnResult\r\n\r\n','C++','C++标准脚本','2018-01-29 14:43:33','2018-01-29 14:43:33'),(3,20,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待执行的评测文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 执行命令\r\nexecuteCommand=\"python\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\n\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n # 循环获取各测试用例下的实际输出\r\n res_usage=\"{\\\"testSetUsages\\\":[\"\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes\r\n startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n # 拼接输出结果\r\n endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n let testSetCpuUsage=$endCpuUsage-$startCpuUsage\r\n maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)\r\n res_usage=\"$res_usage{\\\"testSetTime\\\":\\\"$testSetCpuUsage\\\",\\\"testSetMem\\\":\\\"$maxMemUsage\\\"},\"\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\n\r\nexecute $1\r\nres_usage=\"${res_usage::-1}\"\r\nres_usage=\"$res_usage]}\"\r\nres_usage=$(echo -ne \"$res_usage\"|base64) \r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output,\\\"resUsage\\\":\\\"$res_usage\\\"}\"\r\n echo $result\r\n}\r\nreturnResult','Android','Android默认脚本','2018-01-29 14:45:55','2019-07-19 13:52:03'),(4,34,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待执行的评测文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 执行命令\r\nexecuteCommand=\"bash\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\n\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n # 循环获取各测试用例下的实际输出\r\n res_usage=\"{\\\"testSetUsages\\\":[\"\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes\r\n startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n # 拼接输出结果\r\n endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n let testSetCpuUsage=$endCpuUsage-$startCpuUsage\r\n maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)\r\n res_usage=\"$res_usage{\\\"testSetTime\\\":\\\"$testSetCpuUsage\\\",\\\"testSetMem\\\":\\\"$maxMemUsage\\\"},\"\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\nexecute $1\r\nres_usage=\"${res_usage::-1}\"\r\nres_usage=\"$res_usage]}\"\r\nres_usage=$(echo -ne \"$res_usage\"|base64)\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output,\\\"resUsage\\\":\\\"$res_usage\\\"}\"\r\n echo $result\r\n}\r\nreturnResult','Docker','Docker标准脚本','2018-01-29 14:57:28','2019-07-19 11:23:54'),(5,3,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待执行的评测文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 执行命令\r\nexecuteCommand=\"bash\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\n\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n # 循环获取各测试用例下的实际输出\r\n res_usage=\"{\\\"testSetUsages\\\":[\"\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes\r\n startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n # 拼接输出结果\r\n endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n let testSetCpuUsage=$endCpuUsage-$startCpuUsage\r\n maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)\r\n res_usage=\"$res_usage{\\\"testSetTime\\\":\\\"$testSetCpuUsage\\\",\\\"testSetMem\\\":\\\"$maxMemUsage\\\"},\"\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\n\r\nexecute $1\r\nres_usage=\"${res_usage::-1}\"\r\nres_usage=\"$res_usage]}\"\r\nres_usage=$(echo -ne \"$res_usage\"|base64)\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output,\\\"resUsage\\\":\\\"$res_usage\\\"}\"\r\n echo $result\r\n}\r\nreturnResult','Dynamips','Dynamips标准脚本','2018-01-29 14:58:29','2019-07-19 11:25:27'),(6,19,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待执行的评测文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 执行命令\r\nexecuteCommand=\"elixir\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\n\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n # 循环获取各测试用例下的实际输出\r\n res_usage=\"{\\\"testSetUsages\\\":[\"\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes\r\n startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n # 拼接输出结果\r\n endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n let testSetCpuUsage=$endCpuUsage-$startCpuUsage\r\n maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)\r\n res_usage=\"$res_usage{\\\"testSetTime\\\":\\\"$testSetCpuUsage\\\",\\\"testSetMem\\\":\\\"$maxMemUsage\\\"},\"\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\nexecute $1\r\nres_usage=\"${res_usage::-1}\"\r\nres_usage=\"$res_usage]}\"\r\nres_usage=$(echo -ne \"$res_usage\"|base64)\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output,\\\"resUsage\\\":\\\"$res_usage\\\"}\"\r\n echo $result\r\n}\r\nreturnResult','Elixir','Elixir标准脚本','2018-01-29 14:59:17','2019-07-19 11:27:24'),(7,12,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待执行的评测文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 执行命令\r\nexecuteCommand=\"python\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\n\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n # 循环获取各测试用例下的实际输出\r\n res_usage=\"{\\\"testSetUsages\\\":[\"\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes\r\n startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n # 拼接输出结果\r\n endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n let testSetCpuUsage=$endCpuUsage-$startCpuUsage\r\n maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)\r\n res_usage=\"$res_usage{\\\"testSetTime\\\":\\\"$testSetCpuUsage\\\",\\\"testSetMem\\\":\\\"$maxMemUsage\\\"},\"\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\nexecute $1\r\nres_usage=\"${res_usage::-1}\"\r\nres_usage=\"$res_usage]}\"\r\nres_usage=$(echo -ne \"$res_usage\"|base64)\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output,\\\"resUsage\\\":\\\"$res_usage\\\"}\"\r\n echo $result\r\n}\r\nreturnResult','Git','Git标准脚本','2018-01-29 14:59:50','2019-07-19 11:31:34'),(8,24,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待执行的评测文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 执行命令\r\nexecuteCommand=\"go run\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\n\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡的执行目标文件 \r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n # 循环获取各测试用例下的实际输出\r\n res_usage=\"{\\\"testSetUsages\\\":[\"\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes\r\n startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n # 拼接输出结果\r\n endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n let testSetCpuUsage=$endCpuUsage-$startCpuUsage\r\n maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)\r\n res_usage=\"$res_usage{\\\"testSetTime\\\":\\\"$testSetCpuUsage\\\",\\\"testSetMem\\\":\\\"$maxMemUsage\\\"},\"\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\nexecute $1\r\nres_usage=\"${res_usage::-1}\"\r\nres_usage=\"$res_usage]}\"\r\nres_usage=$(echo -ne \"$res_usage\"|base64)\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output,\\\"resUsage\\\":\\\"$res_usage\\\"}\"\r\n echo $result\r\n}\r\nreturnResult','Go','Go标准脚本','2018-01-29 15:00:35','2019-07-19 11:33:07'),(9,7,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待编译的评测文件\r\nchallengeProgramNames=(CHALLENGEPROGRAMNAMES)\r\n# 待执行的评测文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\n# 编译函数\r\ncompile(){\r\n cd step$1\r\n # 编译命令\r\n compileCommand=\"/apache-ant-1.10.1/bin/ant -q -S\"\r\n # 取当前关卡的编译文件\r\n challengeProgramName=${challengeProgramNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n############################################\r\n\r\n compileResult=$($compileCommand 2>&1)\r\n echo $compileResult |grep \'BUILD FAILED\' >/dev/null\r\n if [[ $? == 0 ]]; then\r\n compileResult=$(echo -n $compileResult | base64)\r\n else\r\n compileResult=$(echo -n \"compile successfully\" | base64)\r\n fi\r\n\r\n}\r\ncompile $1\r\n\r\nexecute(){\r\n # 执行命令\r\n executeCommand=\"sh $1.sh\"\r\n # 执行文件名\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n # 循环获取各测试用例下的实际输出\r\n res_usage=\"{\\\"testSetUsages\\\":[\"\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes\r\n startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n # 拼接输出结果\r\n endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n let testSetCpuUsage=$endCpuUsage-$startCpuUsage\r\n maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)\r\n res_usage=\"$res_usage{\\\"testSetTime\\\":\\\"$testSetCpuUsage\\\",\\\"testSetMem\\\":\\\"$maxMemUsage\\\"},\"\r\n output=$output\\\"$(cat /tmp/output/part-r-00000 2>/dev/null | base64)\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\n\r\nexecute $1\r\nres_usage=\"${res_usage::-1}\"\r\nres_usage=\"$res_usage]}\"\r\nres_usage=$(echo -ne \"$res_usage\"|base64)\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output,\\\"resUsage\\\":\\\"$res_usage\\\"}\"\r\n echo $result\r\n}\r\nreturnResult\r\n\r\n','Hadoop','Hadoop标准脚本','2018-01-29 15:01:06','2019-07-19 11:38:37'),(10,6,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待执行的评测文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 执行命令\r\nexecuteCommand=\"bash\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\n\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n # 循环获取各测试用例下的实际输出\r\n res_usage=\"{\\\"testSetUsages\\\":[\"\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes\r\n startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n # 拼接输出结果\r\n endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n let testSetCpuUsage=$endCpuUsage-$startCpuUsage\r\n maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)\r\n res_usage=\"$res_usage{\\\"testSetTime\\\":\\\"$testSetCpuUsage\\\",\\\"testSetMem\\\":\\\"$maxMemUsage\\\"},\"\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\nexecute $1\r\nres_usage=\"${res_usage::-1}\"\r\nres_usage=\"$res_usage]}\"\r\nres_usage=$(echo -ne \"$res_usage\"|base64)\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output,\\\"resUsage\\\":\\\"$res_usage\\\"}\"\r\n echo $result\r\n}\r\nreturnResult','hive-shell','','2018-01-29 15:01:39','2019-07-19 14:14:41'),(11,5,'#!/bin/bash\r\ncd WORKSPACE\r\n# 待编译的评测文件\r\nchallengeProgramNames=(CHALLENGEPROGRAMNAMES)\r\n# 待执行的评测文件(可能是编译所得的可执行文件,请按实际情况填写)\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 编译命令\r\ncompileCommand=\"javac -encoding UTF-8 -Djava.ext.dirs=./lib/ -sourcepath src/ -d target/\"\r\n# 执行命令\r\nexecuteCommand=\"java -Dfile.encoding=UTF-8 -Djava.ext.dirs=./lib/ -cp target/\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\n# 限制每个shell连接所能写文件的最大容量\r\necho \'ulimit -f 10000\' >>/root/.bashrc ; source /root/.bashrc\r\n\r\n# 编译函数\r\ncompile(){\r\n # 创建target目录\r\n mkdir target &> /dev/null\r\n # 删除上一次编译生成的文件,防止对本次编译造成影响\r\n rm -rf ./target/** &> /dev/null\r\n # 当前关卡的编译目标文件\r\n challengeProgramName=${challengeProgramNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n \r\n \r\n # 获取编译结果(此处编译无输出则说明编译通过,否则输出编译错误信息,请按实训实际情况调整)\r\n compileResult=$($compileCommand $challengeProgramName 2>&1 | base64)\r\n if [ -z \"$compileResult\" ]; then\r\n compileResult=$(echo -n \"compile successfully\" | base64)\r\n fi\r\n\r\n}\r\ncompile $1\r\n\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n # 循环获取各测试用例下的实际输出\r\n res_usage=\"{\\\"testSetUsages\\\":[\"\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes\r\n startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n # 拼接执行结果\r\n endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n let testSetCpuUsage=$endCpuUsage-$startCpuUsage\r\n maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)\r\n res_usage=\"$res_usage{\\\"testSetTime\\\":\\\"$testSetCpuUsage\\\",\\\"testSetMem\\\":\\\"$maxMemUsage\\\"},\"\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\nexecute $1\r\nres_usage=\"${res_usage::-1}\"\r\nres_usage=\"$res_usage]}\"\r\nres_usage=$(echo -ne \"$res_usage\"|base64)\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output,\\\"resUsage\\\":\\\"$res_usage\\\"}\"\r\n echo $result\r\n}\r\nreturnResult\r\n\r\n','Java','Java默认脚本','2018-01-29 15:02:23','2019-07-19 14:16:22'),(12,16,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待执行的评测文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 执行命令\r\nexecuteCommand=\"node\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\n\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n # 循环获取各测试用例下的实际输出\r\n res_usage=\"{\\\"testSetUsages\\\":[\"\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes\r\n startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n # 拼接输出结果\r\n endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n let testSetCpuUsage=$endCpuUsage-$startCpuUsage\r\n maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)\r\n res_usage=\"$res_usage{\\\"testSetTime\\\":\\\"$testSetCpuUsage\\\",\\\"testSetMem\\\":\\\"$maxMemUsage\\\"},\"\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\n\r\nexecute $1\r\nres_usage=\"${res_usage::-1}\"\r\nres_usage=\"$res_usage]}\"\r\nres_usage=$(echo -ne \"$res_usage\"|base64)\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output,\\\"resUsage\\\":\\\"$res_usage\\\"}\"\r\n echo $result\r\n}\r\nreturnResult','JavaScript','JavaScript标准脚本','2018-01-29 15:03:04','2019-07-19 14:18:41'),(13,22,'#!/bin/bash\r\n#tomcat路径:/home/apache-tomcat-8.5.20/\r\ncd WORKSPACEjfinalshop\r\n\r\nsourceClassNames=(SOURCECLASSNAMES)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\necho \'ulimit -f 1000000\' >>/root/.bashrc ; source /root/.bashrc\r\n\r\nrestartTomcat(){\r\n bash /home/apache-tomcat-8.5.20/bin/shutdown.sh &> /dev/null\r\n bash /home/apache-tomcat-8.5.20/bin/startup.sh &> /dev/null\r\n while :;\r\n do\r\n sleep 1\r\n cat /home/apache-tomcat-8.5.20/logs/catalina.out| tail -20 | grep \'startup in\' &> /dev/null\r\n if [ $? -eq 0 ]\r\n then\r\n break\r\n fi\r\n done\r\n}\r\n\r\ncompile(){\r\n compileCommand=\"ant -q -S\"\r\n\r\n compileResult=$($compileCommand 2>&1)\r\n failedInfo=\"BUILD FAILED\"\r\n if [[ $compileResult == *$failedInfo* ]]; then\r\n compileResult=$(echo -n $compileResult | base64)\r\n else\r\n compileResult=$(echo -n \"compile successfully\" | base64)\r\n\r\n restartTomcat\r\n fi\r\n}\r\n\r\ncompile $1\r\n\r\nexecute(){\r\n executeCommand=\"java -Dfile.encoding=UTF-8 -Djava.ext.dirs=../../WebRoot/WEB-INF/lib \"\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n challengeStage=$1\r\n\r\n # 切换到编译文件的目录\r\n cd build/classes\r\n res_usage=\"{\\\"testSetUsages\\\":[\"\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes\r\n startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n #执行,并拼接执行结果\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n #拼接输出结果\r\n endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n let testSetCpuUsage=$endCpuUsage-$startCpuUsage\r\n maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)\r\n res_usage=\"$res_usage{\\\"testSetTime\\\":\\\"$testSetCpuUsage\\\",\\\"testSetMem\\\":\\\"$maxMemUsage\\\"},\"\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\n\r\nexecute $1\r\nres_usage=\"${res_usage::-1}\"\r\nres_usage=\"$res_usage]}\"\r\nres_usage=$(echo -ne \"$res_usage\"|base64)\r\n#return result in json format\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output,\\\"resUsage\\\":\\\"$res_usage\\\"}\"\r\n echo $result\r\n}\r\n#拼装成最终的json格式,echo输出得到最后结果\r\nreturnResult\r\n\r\n','JFinal','JFinal标准脚本','2018-01-29 15:03:43','2019-07-19 14:22:22'),(14,18,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待编译的评测文件\r\nchallengeProgramNames=(CHALLENGEPROGRAMNAMES)\r\n# 待执行的评测文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 编译命令\r\ncompileCommand=\"kotlinc -include-runtime -d mainfun.jar\"\r\n# 执行命令\r\nexecuteCommand=\"java -jar mainfun.jar\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\n# 编译函数\r\ncompile(){\r\n # 当前关卡的编译目标文件\r\n challengeProgramName=${challengeProgramNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n # 删除上一次编译生成的文件,防止对本次编译造成影响\r\n rm -rf *.jar &> /dev/null\r\n rm -rf ./target/** &> /dev/null\r\n # 获取编译结果(此处编译无输出则说明编译通过,否则输出编译错误信息,请按实训实际情况调整)\r\n compileResult=$($compileCommand $challengeProgramName 2>&1 | base64)\r\n if [ -z \"$compileResult\" ]; then\r\n compileResult=$(echo -n \"compile successfully\" | base64)\r\n fi\r\n\r\n}\r\ncompile $1\r\n\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n # 循环获取各测试用例下的实际输出\r\n res_usage=\"{\\\"testSetUsages\\\":[\"\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes\r\n startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n # 拼接输出结果\r\n endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n let testSetCpuUsage=$endCpuUsage-$startCpuUsage\r\n maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)\r\n res_usage=\"$res_usage{\\\"testSetTime\\\":\\\"$testSetCpuUsage\\\",\\\"testSetMem\\\":\\\"$maxMemUsage\\\"},\"\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\nexecute $1\r\nres_usage=\"${res_usage::-1}\"\r\nres_usage=\"$res_usage]}\"\r\nres_usage=$(echo -ne \"$res_usage\"|base64)\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output,\\\"resUsage\\\":\\\"$res_usage\\\"}\"\r\n echo $result\r\n}\r\nreturnResult\r\n\r\n','Kotlin','Kotlin标准脚本','2018-01-29 15:04:13','2019-07-19 14:26:51'),(15,30,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待执行的评测文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 执行命令\r\nexecuteCommand=\"python\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2; OLD_IFS=\"$IFS\"; IFS=,; ins=($input); IFS=\"$OLD_IFS\"\r\n\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\n\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n # 循环获取各测试用例下的实际输出\r\n res_usage=\"{\\\"testSetUsages\\\":[\"\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes\r\n startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n #拼接输出结果\r\n endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n let testSetCpuUsage=$endCpuUsage-$startCpuUsage\r\n maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)\r\n res_usage=\"$res_usage{\\\"testSetTime\\\":\\\"$testSetCpuUsage\\\",\\\"testSetMem\\\":\\\"$maxMemUsage\\\"},\"\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\nexecute $1\r\nres_usage=\"${res_usage::-1}\"\r\nres_usage=\"$res_usage]}\"\r\nres_usage=$(echo -ne \"$res_usage\"|base64)\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output,\\\"resUsage\\\":\\\"$res_usage\\\"}\"\r\n echo $result\r\n}\r\nreturnResult','MachineLearning','MachineLearning标准脚本','2018-01-29 15:04:49','2019-07-19 14:28:50'),(16,10,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待执行的评测文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 执行命令\r\nexecuteCommand=\"octave\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\n\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n # 循环获取各测试用例下的实际输出\r\n res_usage=\"{\\\"testSetUsages\\\":[\"\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes\r\n startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 |grep -vE \"warning: function|octave: unable|octave: disabling\" | base64)\r\n # 拼接输出结果\r\n endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n let testSetCpuUsage=$endCpuUsage-$startCpuUsage\r\n maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)\r\n res_usage=\"$res_usage{\\\"testSetTime\\\":\\\"$testSetCpuUsage\\\",\\\"testSetMem\\\":\\\"$maxMemUsage\\\"},\"\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\nexecute $1\r\nres_usage=\"${res_usage::-1}\"\r\nres_usage=\"$res_usage]}\"\r\nres_usage=$(echo -ne \"$res_usage\"|base64)\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output,\\\"resUsage\\\":\\\"$res_usage\\\"}\"\r\n echo $result\r\n}\r\nreturnResult','Matlab','Matlab标准脚本','2018-01-29 15:05:27','2019-07-19 14:30:10'),(17,17,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待执行的评测文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 执行命令\r\nexecuteCommand=\"perl6\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2; OLD_IFS=\"$IFS\"; IFS=,; ins=($input); IFS=\"$OLD_IFS\"\r\n\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\n\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n # 循环获取各测试用例下的实际输出\r\n res_usage=\"{\\\"testSetUsages\\\":[\"\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes\r\n startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n # 拼接输出结果\r\n endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n let testSetCpuUsage=$endCpuUsage-$startCpuUsage\r\n maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)\r\n res_usage=\"$res_usage{\\\"testSetTime\\\":\\\"$testSetCpuUsage\\\",\\\"testSetMem\\\":\\\"$maxMemUsage\\\"},\"\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\n\r\nexecute $1\r\nres_usage=\"${res_usage::-1}\"\r\nres_usage=\"$res_usage]}\"\r\nres_usage=$(echo -ne \"$res_usage\"|base64)\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output,\\\"resUsage\\\":\\\"$res_usage\\\"}\"\r\n echo $result\r\n}\r\nreturnResult','Perl6','Perl6标准脚本','2018-01-29 15:06:34','2019-07-19 15:00:31'),(18,9,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待执行的评测文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 执行命令\r\nexecuteCommand=\"php\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\n\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n # 循环获取各测试用例下的实际输出\r\n res_usage=\"{\\\"testSetUsages\\\":[\"\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes\r\n startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n # 拼接输出结果\r\n endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n let testSetCpuUsage=$endCpuUsage-$startCpuUsage\r\n maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)\r\n res_usage=\"$res_usage{\\\"testSetTime\\\":\\\"$testSetCpuUsage\\\",\\\"testSetMem\\\":\\\"$maxMemUsage\\\"},\"\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\nexecute $1\r\nres_usage=\"${res_usage::-1}\"\r\nres_usage=\"$res_usage]}\"\r\nres_usage=$(echo -ne \"$res_usage\"|base64)\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output,\\\"resUsage\\\":\\\"$res_usage\\\"}\"\r\n echo $result\r\n}\r\nreturnResult','PHP','PHP标准脚本','2018-01-29 15:07:02','2019-07-19 15:03:08'),(19,4,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待执行的评测文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 执行命令\r\nexecuteCommand=\"python\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2; OLD_IFS=\"$IFS\"; IFS=,; ins=($input); IFS=\"$OLD_IFS\"\r\n\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\n\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n # 循环获取各测试用例下的实际输出\r\n res_usage=\"{\\\"testSetUsages\\\":[\"\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes\r\n startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n #拼接输出结果\r\n endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n let testSetCpuUsage=$endCpuUsage-$startCpuUsage\r\n maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)\r\n res_usage=\"$res_usage{\\\"testSetTime\\\":\\\"$testSetCpuUsage\\\",\\\"testSetMem\\\":\\\"$maxMemUsage\\\"},\"\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\nexecute $1\r\nres_usage=\"${res_usage::-1}\"\r\nres_usage=\"$res_usage]}\"\r\nres_usage=$(echo -ne \"$res_usage\"|base64)\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output,\\\"resUsage\\\":\\\"$res_usage\\\"}\"\r\n echo $result\r\n}\r\nreturnResult','Python2.7','Python2.7标准脚本','2018-01-29 15:09:20','2019-07-19 15:12:14'),(20,2,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待执行的评测文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 执行命令\r\nexecuteCommand=\"python\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2; OLD_IFS=\"$IFS\"; IFS=,; ins=($input); IFS=\"$OLD_IFS\"\r\n\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\n\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n # 循环获取各测试用例下的实际输出\r\n res_usage=\"{\\\"testSetUsages\\\":[\"\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes\r\n startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n #拼接输出结果\r\n endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n let testSetCpuUsage=$endCpuUsage-$startCpuUsage\r\n maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)\r\n res_usage=\"$res_usage{\\\"testSetTime\\\":\\\"$testSetCpuUsage\\\",\\\"testSetMem\\\":\\\"$maxMemUsage\\\"},\"\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\nexecute $1\r\nres_usage=\"${res_usage::-1}\"\r\nres_usage=\"$res_usage]}\"\r\nres_usage=$(echo -ne \"$res_usage\"|base64)\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output,\\\"resUsage\\\":\\\"$res_usage\\\"}\"\r\n echo $result\r\n}\r\nreturnResult','Python3.6','Python3.6标准脚本','2018-01-29 15:10:18','2019-07-19 15:22:37'),(21,2,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待执行的评测文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 执行命令\r\nexecuteCommand=\"python\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2; OLD_IFS=\"$IFS\"; IFS=,; ins=($input); IFS=\"$OLD_IFS\"\r\n\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\n\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n # 循环检测数据库是否已启动\r\n while :;\r\n do\r\n mysql -h127.0.0.1 -uroot -p123123 -e \"show databases\" 2>&1 >/dev/null\r\n if [ $? -eq 0 ];then\r\n break\r\n else\r\n sleep 1\r\n fi\r\n done\r\n \r\n # 循环获取各测试用例下的实际输出\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n # 拼接输出结果\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\n\r\nexecute $1\r\n\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output}\"\r\n echo $result\r\n}\r\nreturnResult','Python3.6/Mysql','增加了等待mysql服务启动;','2018-01-29 15:10:30','2018-01-31 11:17:22'),(22,14,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待执行的评测文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 执行命令\r\nexecuteCommand=\"ruby\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\n\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n # 循环获取各测试用例下的实际输出\r\n res_usage=\"{\\\"testSetUsages\\\":[\"\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes\r\n startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n # 拼接输出结果\r\n endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n let testSetCpuUsage=$endCpuUsage-$startCpuUsage\r\n maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)\r\n res_usage=\"$res_usage{\\\"testSetTime\\\":\\\"$testSetCpuUsage\\\",\\\"testSetMem\\\":\\\"$maxMemUsage\\\"},\"\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\n\r\nexecute $1\r\nres_usage=\"${res_usage::-1}\"\r\nres_usage=\"$res_usage]}\"\r\nres_usage=$(echo -ne \"$res_usage\"|base64)\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output,\\\"resUsage\\\":\\\"$res_usage\\\"}\"\r\n echo $result\r\n}\r\nreturnResult','Ruby','Ruby标准脚本','2018-01-29 15:11:04','2019-07-19 15:26:36'),(23,8,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待编译的评测文件\r\nchallengeProgramNames=(CHALLENGEPROGRAMNAMES)\r\n# 当前关卡的编译目标文件\r\nchallengeProgramName=${challengeProgramNames[$1 - 1]}\r\n# 编译命令\r\ncompileCommand=\"gcc $challengeProgramName -lSDL2 -lSDL2_image -lSDL2_mixer\"\r\n# 执行命令\r\nexecuteCommand=\"./a.out\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\n# 编译函数\r\ncompile(){\r\n # 当前关卡号\r\n challengeStage=$1\r\n # 删除上一次编译生成的文件,防止对本次编译造成影响\r\n rm -f ./target/step$challengeStage/*.class &> /dev/null\r\n #compile 编译文件,并将编译结果输出至compile_result_$challengeStage.out\r\n $compileCommand > compile_result_$challengeStage.out 2>&1\r\n #检测编译输出文件是否为空,编译成功的时候没有输出,有输出就说明编译失败。\r\n #拿到编译结果,并用base64编码\r\n compileResult=\'\'\r\n if test -s compile_result_$challengeStage.out; then\r\n compileResult=$(cat compile_result_$challengeStage.out | base64)\r\n else\r\n compileResult=$(echo -n \"compile successfully\" | base64)\r\n fi\r\n}\r\ncompile $1\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡号\r\n challengeStage=$1\r\n # 循环获取各测试用例下的实际输出\r\n res_usage=\"{\\\"testSetUsages\\\":[\"\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes\r\n startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand 2>&1 | base64)\r\n # 拼接输出结果\r\n endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n let testSetCpuUsage=$endCpuUsage-$startCpuUsage\r\n maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)\r\n res_usage=\"$res_usage{\\\"testSetTime\\\":\\\"$testSetCpuUsage\\\",\\\"testSetMem\\\":\\\"$maxMemUsage\\\"},\"\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\nexecute $1\r\nres_usage=\"${res_usage::-1}\"\r\nres_usage=\"$res_usage]}\"\r\nres_usage=$(echo -ne \"$res_usage\"|base64)\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output,\\\"resUsage\\\":\\\"$res_usage\\\"}\"\r\n echo $result\r\n}\r\nreturnResult','SDL','SDL标准脚本','2018-01-29 15:11:50','2019-07-19 15:28:33'),(24,15,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待执行的评测文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 执行命令\r\nexecuteCommand=\"bash\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\n\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n # 循环获取各测试用例下的实际输出\r\n res_usage=\"{\\\"testSetUsages\\\":[\"\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes\r\n startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n # 拼接输出结果\r\n endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n let testSetCpuUsage=$endCpuUsage-$startCpuUsage\r\n maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)\r\n res_usage=\"$res_usage{\\\"testSetTime\\\":\\\"$testSetCpuUsage\\\",\\\"testSetMem\\\":\\\"$maxMemUsage\\\"},\"\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\nexecute $1\r\nres_usage=\"${res_usage::-1}\"\r\nres_usage=\"$res_usage]}\"\r\nres_usage=$(echo -ne \"$res_usage\"|base64)\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output,\\\"resUsage\\\":\\\"$res_usage\\\"}\"\r\n echo $result\r\n}\r\nreturnResult','Shell','','2018-01-29 15:12:29','2019-07-19 15:34:04'),(25,29,'########\r\n#有些命令会有不必要的输出要过滤掉(grep -v)或者直接去掉所有输出(2>&1 >/dev/null);\r\n########\r\n#进入版本库目录(WORKSPACE平台会替换为版本库的绝对路径)\r\ncd WORKSPACE\r\n#将spark实训程序所需输入文件放入/tmp/路径,程序再从/tmp/1.txt读取输入(因为代码拿不到版本库输入文件的绝对路径);\r\ncp ./1.txt /tmp/ 2>&1 >/dev/null\r\n\r\n#mvn编译时的路径\r\nCompilePath=(\"第一关编译路径\" \"第二关编译路径\" \"第三关编译路径\" \"...\")\r\n#mvn编译命令\r\ncompileCommand=\"mvn package \"\r\n\r\n#spark执行的jar包的绝对路径(WORKSPACE+当前路径=绝对路径)\r\nExecutePath=(\"WORKSPACE/step1/target/*.jar\" \"WORKSPACE/step2/target/*.jar\" \"WORKSPACE/step3/target/*.jar\")\r\n#执行命令\r\nexecuteCommand=\"spark-submit --class $ClassName_Now $ExecutePath_Now\"\r\n\r\n#spark执行时的class名称\r\nClassName=(\"step1\" \"step2\" \"step3\")\r\n\r\n\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\necho \'ulimit -f 1000000\' >>/root/.bashrc ; source /root/.bashrc\r\n#编译函数\r\ncompile(){\r\n #获取当前关卡的编译路径\r\n CompilePath_Now=${CompilePath[$1 - 1]}\r\n #进入编译目录\r\n cd $CompilePath_Now\r\n\r\n #清除历史jar包\r\n rm -f ./target/*.jar 2>&1 >/dev/null\r\n #获取编译结果\r\n compileResult=$($compileCommand 2>&1 | base64)\r\n if [ -f ./target/*.jar ]; then\r\n compileResult=$(echo -n \"compile successfully\" | base64)\r\n fi\r\n\r\n}\r\n#\"$1\"(第几关:1/2/3..)为平台传入的编译函数执行参数\r\ncompile $1\r\n\r\n\r\nexecute(){\r\n #获取当前关卡执行文件路径\r\n ExecutePath_Now=${ExecutePath[$1 - 1]}\r\n #获取当前关卡执行类名\r\n ClassName_Now=${ClassName[$1 - 1]}\r\n\r\n res_usage=\"{\\\"testSetUsages\\\":[\"\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes\r\n startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n #执行,并拼接执行结果\r\n #使用sed命令过滤掉没用的输出\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand 2>&1 |grep -vE \"spark-env|SPARK_LOCAL_IP|Printing new\" |sed \'s/.*(/(/\' | base64)\r\n #拼接输出结果\r\n endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n let testSetCpuUsage=$endCpuUsage-$startCpuUsage\r\n maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)\r\n res_usage=\"$res_usage{\\\"testSetTime\\\":\\\"$testSetCpuUsage\\\",\\\"testSetMem\\\":\\\"$maxMemUsage\\\"},\"\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\n\r\nexecute $1\r\nres_usage=\"${res_usage::-1}\"\r\nres_usage=\"$res_usage]}\"\r\nres_usage=$(echo -ne \"$res_usage\"|base64)\r\n#return result in json format\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output,\\\"resUsage\\\":\\\"$res_usage\\\"}\"\r\n echo $result\r\n}\r\n#拼装成最终的json格式,echo输出得到最后结果\r\nreturnResult\r\n','Spark','Spark标准脚本','2018-01-29 15:13:08','2019-07-19 15:36:28'),(26,32,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待编译的评测文件\r\nchallengeProgramNames=(CHALLENGEPROGRAMNAMES)\r\n\r\n# 编译命令\r\ncompileCommand=\"iverilog\"\r\n\r\n# 执行命令\r\nexecuteCommand=\"vvp\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\n# 编译函数\r\ncompile(){\r\n # 当前关卡的编译目标文件\r\n challengeProgramName=${challengeProgramNames[$1 - 1]}\r\n # 删除上一次编译生成的文件,防止对本次编译造成影响\r\n rm -f ./executeFile.out &> /dev/null\r\n # 获取编译结果(此处编译无输出则说明编译通过,否则输出编译错误信息,请按实训实际情况调整)\r\n compileResult=$($compileCommand $challengeProgramName -o executeFile.out 2>&1 | base64)\r\n if [ -z \"$compileResult\" ]; then\r\n compileResult=$(echo -n \"compile successfully\" | base64)\r\n fi\r\n}\r\ncompile $1\r\n\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡号\r\n challengeStage=$1\r\n # 循环获取各测试用例下的实际输出\r\n res_usage=\"{\\\"testSetUsages\\\":[\"\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes\r\n startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand executeFile.out 2>&1 | base64)\r\n # 拼接输出结果\r\n endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n let testSetCpuUsage=$endCpuUsage-$startCpuUsage\r\n maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)\r\n res_usage=\"$res_usage{\\\"testSetTime\\\":\\\"$testSetCpuUsage\\\",\\\"testSetMem\\\":\\\"$maxMemUsage\\\"},\"\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\nexecute $1\r\nres_usage=\"${res_usage::-1}\"\r\nres_usage=\"$res_usage]}\"\r\nres_usage=$(echo -ne \"$res_usage\"|base64)\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output,\\\"resUsage\\\":\\\"$res_usage\\\"}\"\r\n echo $result\r\n}\r\nreturnResult\r\n\r\n','Verilog','Verilog标准脚本','2018-01-29 15:13:46','2019-07-19 15:49:43'),(27,39,'#!/bin/bash\r\n#工作空间\r\ncd WORKSPACE\r\n# 待编译的评测文件\r\nchallengeProgramNames=(CHALLENGEPROGRAMNAMES)\r\n# 待执行的评测文件(可能是编译所得的可执行文件,请按实际情况填写)\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 编译命令\r\ncompileCommand=\"mcs -warn:0\"\r\n# 执行命令\r\nexecuteCommand=\"mono\"\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n#限制每个shell连接所能写文件的最大容量,100M\r\necho \'ulimit -f 10000\' >>/root/.bashrc ; source /root/.bashrc\r\ncompile(){\r\n #取当前关卡的编译文件\r\n challengeProgramName=${challengeProgramNames[$1 - 1]}\r\n #当前关卡,作为参数传进来\r\n challengeStage=$1\r\n #删除上一次编译生成的文件,防止对本次编译造成影响\r\n rm -f ./target/step$challengeStage/*.class &> /dev/null\r\n #compile 编译文件,并将编译结果输出至compile_result_$challengeStage.out\r\n $compileCommand $challengeProgramName > compile_result_$challengeStage.out 2>&1\r\n #检测编译输出文件是否为空,编译成功的时候没有输出,有输出就说明编译失败。\r\n #拿到编译结果,并用base64编码\r\n compileResult=\'\'\r\n if test -s compile_result_$challengeStage.out; then\r\n compileResult=$(cat compile_result_$challengeStage.out | base64)\r\n else\r\n compileResult=$(echo -n \"compile successfully\" | base64)\r\n fi\r\n}\r\ncompile $1\r\nexecute(){\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n challengeStage=$1\r\n res_usage=\"{\\\"testSetUsages\\\":[\"\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes\r\n startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n #执行,并拼接执行结果\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n #拼接输出结果\r\n endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n let testSetCpuUsage=$endCpuUsage-$startCpuUsage\r\n maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)\r\n res_usage=\"$res_usage{\\\"testSetTime\\\":\\\"$testSetCpuUsage\\\",\\\"testSetMem\\\":\\\"$maxMemUsage\\\"},\"\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\nexecute $1\r\nres_usage=\"${res_usage::-1}\"\r\nres_usage=\"$res_usage]}\"\r\nres_usage=$(echo -ne \"$res_usage\"|base64)\r\n#return result in json format\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output,\\\"resUsage\\\":\\\"$res_usage\\\"}\"\r\n echo $result\r\n}\r\n#拼装成最终的json格式,echo输出得到最后结果\r\nreturnResult','C#','C#标准脚本','2018-01-29 16:17:52','2019-07-19 13:53:10'),(29,9,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待执行的评测文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 执行命令\r\nexecuteCommand=\"php\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\n\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n # 循环检测数据库是否已启动\r\n while :;\r\n do\r\n mysql -h127.0.0.1 -uroot -p123123 -e \"show databases\" 2>&1 >/dev/null\r\n if [ $? -eq 0 ];then\r\n break\r\n else\r\n sleep 1\r\n fi\r\n done\r\n # 循环获取各测试用例下的实际输出\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n # 拼接输出结果\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\nexecute $1\r\n\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output}\"\r\n echo $result\r\n}\r\nreturnResult','PHP/MYSQL','增加了检测数据库是否启动','2018-02-02 16:43:14','2018-02-02 16:43:14'),(30,5,'#!/bin/bash\r\ncd WORKSPACE\r\n# 待编译的评测文件\r\nchallengeProgramNames=(CHALLENGEPROGRAMNAMES)\r\n# 待执行的评测文件(可能是编译所得的可执行文件,请按实际情况填写)\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 编译命令\r\ncompileCommand=\"javac -encoding UTF-8 -Djava.ext.dirs=./lib/ -sourcepath src/ -d target/\"\r\n# 执行命令\r\nexecuteCommand=\"java -Dfile.encoding=UTF-8 -Djava.ext.dirs=./lib/ -cp target/\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\n# 限制每个shell连接所能写文件的最大容量\r\necho \'ulimit -f 10000\' >>/root/.bashrc ; source /root/.bashrc\r\n\r\n# 编译函数\r\ncompile(){\r\n # 当前关卡的编译目标文件\r\n challengeProgramName=${challengeProgramNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n # 删除上一次编译生成的文件,防止对本次编译造成影响\r\n rm -f ./target/step$challengeStage/*.class &> /dev/null\r\n \r\n # 获取编译结果(此处编译无输出则说明编译通过,否则输出编译错误信息,请按实训实际情况调整)\r\n compileResult=$($compileCommand $challengeProgramName 2>&1 | base64)\r\n if [ -z \"$compileResult\" ]; then\r\n compileResult=$(echo -n \"compile successfully\" | base64)\r\n fi\r\n\r\n}\r\ncompile $1\r\n\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n # 循环检测数据库是否已启动\r\n while :;\r\n do\r\n mysql -h127.0.0.1 -uroot -p123123 -e \"show databases\" 2>&1 >/dev/null\r\n if [ $? -eq 0 ];then\r\n break\r\n else\r\n sleep 1\r\n fi\r\n done\r\n # 循环获取各测试用例下的实际输出\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n # 拼接执行结果\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\nexecute $1\r\n\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output}\"\r\n echo $result\r\n}\r\nreturnResult\r\n\r\n','Java/Mysql','增加了等待mysql服务启动;','2018-02-02 16:44:30','2018-02-02 16:44:30'),(31,4,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待执行的评测文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 执行命令\r\nexecuteCommand=\"python\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2; OLD_IFS=\"$IFS\"; IFS=,; ins=($input); IFS=\"$OLD_IFS\"\r\n\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\n\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n # 循环检测数据库是否已启动\r\n while :;\r\n do\r\n mysql -h127.0.0.1 -uroot -p123123 -e \"show databases\" 2>&1 >/dev/null\r\n if [ $? -eq 0 ];then\r\n break\r\n else\r\n sleep 1\r\n fi\r\n done\r\n # 循环获取各测试用例下的实际输出\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n #拼接输出结果\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\nexecute $1\r\n\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output}\"\r\n echo $result\r\n}\r\nreturnResult','Python2.7/Mysql','增加了等待mysql服务启动;','2018-02-02 16:45:53','2018-02-02 16:45:53'),(32,9,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待执行的评测文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 执行命令\r\nexecuteCommand=\"php\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\n\r\n# 启动php自建web服务器,端口为80\r\nrunserver(){\r\n # 判断php是否已启动,未启动则启动phpweb \r\n ps -ef | grep php | grep -v grep \r\n if [ $? -eq 0 ]; then\r\n nohup php -S 0.0.0.0:8080 &> /dev/null &\r\n fi\r\n}\r\nrunserver\r\n\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n # 循环获取各测试用例下的实际输出\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n # 拼接输出结果\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\nexecute $1\r\n\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output}\"\r\n echo $result\r\n}\r\nreturnResult','PHP-Web','PHP-Web实训','2018-02-02 17:06:57','2018-02-02 17:11:39'),(33,64,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n#前台传来的可执行文件,即测试文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\n#不需要编译,设定编译结果为成功编译\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\necho \'ulimit -f 10000\' >>/root/.bashrc ; source /root/.bashrc\r\n\r\nexecute(){\r\n executeCommand=\"bash \"\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n challengeStage=$1\r\n \r\n #get the loop times(looptimes = the num of testdataset)\r\n res_usage=\"{\\\"testSetUsages\\\":[\"\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes\r\n startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n #执行,并拼接执行结果\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n #拼接输出结果\r\n endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n let testSetCpuUsage=$endCpuUsage-$startCpuUsage\r\n maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)\r\n res_usage=\"$res_usage{\\\"testSetTime\\\":\\\"$testSetCpuUsage\\\",\\\"testSetMem\\\":\\\"$maxMemUsage\\\"},\"\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\n\r\nexecute $1\r\nres_usage=\"${res_usage::-1}\"\r\nres_usage=\"$res_usage]}\"\r\nres_usage=$(echo -ne \"$res_usage\"|base64)\r\n#return result in json format\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output,\\\"resUsage\\\":\\\"$res_usage\\\"}\"\r\n echo $result\r\n}\r\n#拼装成最终的json格式,echo输出得到最后结果\r\nreturnResult','SQLite3','SQLite标准模板','2018-03-06 14:07:08','2019-07-19 15:38:42'),(34,66,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n#前台传来的可执行文件,即测试文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\n#不需要编译,设定编译结果为成功编译\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\necho \'ulimit -f 10000\' >>/root/.bashrc ; source /root/.bashrc\r\n\r\nexecute(){\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n executeCommand=\"sqlplus system/oracle @./$sourceClassName \"\r\n challengeStage=$1\r\n while :\r\n do \r\n stat=`service oracle-xe status |grep READY|wc -l`\r\n if [ $stat == 2 ];then\r\n break\r\n else\r\n sleep 1\r\n fi\r\n done\r\n #get the loop times(looptimes = the num of testdataset)\r\n res_usage=\"{\\\"testSetUsages\\\":[\"\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes\r\n startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n #执行,并拼接执行结果\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand |sed -n \'9,10000p\'|grep -v \'Disconnected from\' 2>&1 | base64)\r\n #拼接输出结果\r\n endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n let testSetCpuUsage=$endCpuUsage-$startCpuUsage\r\n maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)\r\n res_usage=\"$res_usage{\\\"testSetTime\\\":\\\"$testSetCpuUsage\\\",\\\"testSetMem\\\":\\\"$maxMemUsage\\\"},\"\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\n\r\nexecute $1\r\nres_usage=\"${res_usage::-1}\"\r\nres_usage=\"$res_usage]}\"\r\nres_usage=$(echo -ne \"$res_usage\"|base64)\r\n#return result in json format\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output,\\\"resUsage\\\":\\\"$res_usage\\\"}\"\r\n echo $result\r\n}\r\n#拼装成最终的json格式,echo输出得到最后结果\r\nreturnResult','Oracle','Oracle标准模板','2018-03-29 15:21:34','2019-07-19 14:58:49'),(35,94,'#!/bin/bash\r\ncd WORKSPACE\r\n# 待编译的评测文件\r\nchallengeProgramNames=(CHALLENGEPROGRAMNAMES)\r\n# 待执行的评测文件(可能是编译所得的可执行文件,请按实际情况填写)\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n# ins:各测试用例输入所组成的数组 $1:当前关卡号 $2:测试用例原始输入\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\n# 限制每个shell连接所能写文件的最大容量\r\necho \'ulimit -f 10000\' >>/root/.bashrc ; source /root/.bashrc\r\n\r\n# 编译函数\r\ncompile(){\r\n # 编译命令\r\n compileCommand=\"ghdl -a\" \r\n # 当前关卡的编译目标文件\r\n challengeProgramName=${challengeProgramNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n # 删除上一次编译生成的文件,防止对本次编译造成影响\r\n rm -f ./target/step$challengeStage/*.class &> /dev/null\r\n \r\n # 获取编译结果(此处编译无输出则说明编译通过,否则输出编译错误信息,请按实训实际情况调整)\r\n compileResult=$($compileCommand $challengeProgramName 2>&1 | base64)\r\n if [ -z \"$compileResult\" ]; then\r\n compileResult=$(echo -n \"compile successfully\" | base64)\r\n fi\r\n\r\n}\r\ncompile $1\r\n\r\n# 执行函数\r\nexecute(){\r\n # 执行命令\r\n executeCommand=\"ghdl -r entity_name\"\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n # 循环获取各测试用例下的实际输出\r\n res_usage=\"{\\\"testSetUsages\\\":[\"\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes\r\n startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n # 执行\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand 2>&1 | base64)\r\n # 拼接执行结果\r\n endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n let testSetCpuUsage=$endCpuUsage-$startCpuUsage\r\n maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)\r\n res_usage=\"$res_usage{\\\"testSetTime\\\":\\\"$testSetCpuUsage\\\",\\\"testSetMem\\\":\\\"$maxMemUsage\\\"},\"\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\nexecute $1\r\nres_usage=\"${res_usage::-1}\"\r\nres_usage=\"$res_usage]}\"\r\nres_usage=$(echo -ne \"$res_usage\"|base64)\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output,\\\"resUsage\\\":\\\"$res_usage\\\"}\"\r\n echo $result\r\n}\r\nreturnResult\r\n\r\n','Vhdl','Vhdl标准模板','2018-04-04 17:22:33','2019-07-19 15:51:49'),(36,95,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待执行的评测文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 执行命令\r\nexecuteCommand=\"Rscript\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2; OLD_IFS=\"$IFS\"; IFS=,; ins=($input); IFS=\"$OLD_IFS\"\r\n\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\n\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n # 循环获取各测试用例下的实际输出\r\n res_usage=\"{\\\"testSetUsages\\\":[\"\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes\r\n startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n #拼接输出结果\r\n endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n let testSetCpuUsage=$endCpuUsage-$startCpuUsage\r\n maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)\r\n res_usage=\"$res_usage{\\\"testSetTime\\\":\\\"$testSetCpuUsage\\\",\\\"testSetMem\\\":\\\"$maxMemUsage\\\"},\"\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\nexecute $1\r\nres_usage=\"${res_usage::-1}\"\r\nres_usage=\"$res_usage]}\"\r\nres_usage=$(echo -ne \"$res_usage\"|base64)\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output,\\\"resUsage\\\":\\\"$res_usage\\\"}\"\r\n echo $result\r\n}\r\nreturnResult','R','R语言标准脚本','2018-04-08 10:32:20','2019-07-19 15:24:13'),(37,96,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n#前台传来的可执行文件,即测试文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\n#不需要编译,设定编译结果为成功编译\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\necho \'ulimit -f 10000\' >>/root/.bashrc ; source /root/.bashrc\r\n\r\nexecute(){\r\n executeCommand=\"swift\"\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n challengeStage=$1\r\n \r\n #get the loop times(looptimes = the num of testdataset)\r\n res_usage=\"{\\\"testSetUsages\\\":[\"\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes\r\n startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n #执行,并拼接执行结果\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n #拼接输出结果\r\n endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n let testSetCpuUsage=$endCpuUsage-$startCpuUsage\r\n maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)\r\n res_usage=\"$res_usage{\\\"testSetTime\\\":\\\"$testSetCpuUsage\\\",\\\"testSetMem\\\":\\\"$maxMemUsage\\\"},\"\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\n\r\nexecute $1\r\nres_usage=\"${res_usage::-1}\"\r\nres_usage=\"$res_usage]}\"\r\nres_usage=$(echo -ne \"$res_usage\"|base64)\r\n#return result in json format\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output,\\\"resUsage\\\":\\\"$res_usage\\\"}\"\r\n echo $result\r\n}\r\n#拼装成最终的json格式,echo输出得到最后结果\r\nreturnResult','swift','swift标准脚本模板','2018-04-09 15:13:58','2019-07-19 15:43:46'),(38,13,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\nchallengeProgramNames=(CHALLENGEPROGRAMNAMES)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\necho \'ulimit -f 1000000\' >>/root/.bashrc ; source /root/.bashrc\r\n\r\ncompile(){\r\n compileCommand=\"g++ `pkg-config --cflags --libs opencv` \"\r\n challengeProgramName=${challengeProgramNames[$1 - 1]}\r\n #remove the executeFile.out file that last time remains\r\n rm -f ./executeFile.out &> /dev/null\r\n\r\n #compile all .c file in the source folder: a/b/c.cpp --> a/b/*.cpp\r\n challengeProgramName=${challengeProgramName%/*.cpp}\"/*.cpp\"\r\n\r\n # 获取编译结果(此处编译无输出则说明编译通过,否则输出编译错误信息,请按实训实际情况调整)\r\n compileResult=$($compileCommand $challengeProgramName -o executeFile.out 2>&1 | base64)\r\n if [ -z \"$compileResult\" ]; then\r\n compileResult=$(echo -n \"compile successfully\" | base64)\r\n fi\r\n\r\n}\r\ncompile $1\r\n\r\n\r\nexecute(){\r\n executeCommand=\"./executeFile.out\"\r\n challengeStage=$1\r\n \r\n #get the loop times(looptimes = the num of testdataset)\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n #执行,并拼接执行结果\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand | base64)\r\n #拼接输出结果\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\n\r\nexecute $1\r\n\r\n#return result in json format\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output}\"\r\n echo $result\r\n}\r\n#拼装成最终的json格式,echo输出得到最后结果\r\nreturnResult\r\n\r\n','Opencv','修改了g++的编译参数\r\n','2018-04-25 10:31:50','2018-04-25 10:32:14'),(39,97,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待执行的评测文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 执行命令\r\nexecuteCommand=\"sqlcmd -S localhost -U sa \"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2; OLD_IFS=\"$IFS\"; IFS=,; ins=($input); IFS=\"$OLD_IFS\"\r\n\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\n\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n # 循环检测数据库是否已启动\r\n while :;\r\n do\r\n sqlcmd -S localhost -U sa -P \'<123123Aa!@>\' -Q \"SELECT Name from sys.Databases\" 2>&1 >/dev/null\r\n if [ $? -eq 0 ];then\r\n break\r\n else\r\n sleep 1\r\n fi\r\n done\r\n # 循环获取各测试用例下的实际输出\r\n res_usage=\"{\\\"testSetUsages\\\":[\"\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes\r\n startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand -P \'<123123Aa!@>\' -i $sourceClassName 2>&1 | base64)\r\n #拼接输出结果\r\n endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n let testSetCpuUsage=$endCpuUsage-$startCpuUsage\r\n maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)\r\n res_usage=\"$res_usage{\\\"testSetTime\\\":\\\"$testSetCpuUsage\\\",\\\"testSetMem\\\":\\\"$maxMemUsage\\\"},\"\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\nexecute $1\r\nres_usage=\"${res_usage::-1}\"\r\nres_usage=\"$res_usage]}\"\r\nres_usage=$(echo -ne \"$res_usage\"|base64)\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output,\\\"resUsage\\\":\\\"$res_usage\\\"}\"\r\n echo $result\r\n}\r\nreturnResult','Sqlserver','Sqlserver标准脚本','2018-04-26 14:05:13','2019-07-19 15:40:11'),(41,98,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n#前台传来的可执行文件,即测试文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\n#不需要编译,设定编译结果为成功编译\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\necho \'ulimit -f 10000\' >>/root/.bashrc ; source /root/.bashrc\r\n\r\nexecute(){\r\n executeCommand=\"mysql -h127.0.0.1 -uroot -p123123 \"\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n challengeStage=$1\r\n # 循环检测数据库是否已启动\r\n while :;\r\n do\r\n mysql -h127.0.0.1 -uroot -p123123 -e \"show databases\" 2>&1 >/dev/null\r\n if [ $? -eq 0 ];then\r\n break\r\n else\r\n sleep 1\r\n fi\r\n done \r\n #get the loop times(looptimes = the num of testdataset)\r\n res_usage=\"{\\\"testSetUsages\\\":[\"\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes\r\n startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n #执行,并拼接执行结果\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand < $sourceClassName 2>&1 | base64)\r\n #拼接输出结果\r\n endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n let testSetCpuUsage=$endCpuUsage-$startCpuUsage\r\n maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)\r\n res_usage=\"$res_usage{\\\"testSetTime\\\":\\\"$testSetCpuUsage\\\",\\\"testSetMem\\\":\\\"$maxMemUsage\\\"},\"\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\n\r\nexecute $1\r\nres_usage=\"${res_usage::-1}\"\r\nres_usage=\"$res_usage]}\"\r\nres_usage=$(echo -ne \"$res_usage\"|base64)\r\n#return result in json format\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output,\\\"resUsage\\\":\\\"$res_usage\\\"}\"\r\n echo $result\r\n}\r\n#拼装成最终的json格式,echo输出得到最后结果\r\nreturnResult','Mysql55标准脚本','Mysql仅执行sql文件','2018-05-10 15:11:34','2019-07-19 14:48:08'),(42,98,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n#前台传来的可执行文件,即测试文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\n#不需要编译,设定编译结果为成功编译\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\necho \'ulimit -f 10000\' >>/root/.bashrc ; source /root/.bashrc\r\n\r\nexecute(){\r\n # 循环检测数据库是否已启动\r\n while :;\r\n do\r\n mysql -h127.0.0.1 -uroot -p123123 -e \"show databases\" 2>&1 >/dev/null\r\n if [ $? -eq 0 ];then\r\n break\r\n else\r\n sleep 1\r\n fi\r\n done\r\n executeCommand=\"bash \"\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n challengeStage=$1\r\n \r\n #get the loop times(looptimes = the num of testdataset)\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n #执行,并拼接执行结果\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n #拼接输出结果\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\n\r\nexecute $1\r\n\r\n#return result in json format\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output}\"\r\n echo $result\r\n}\r\n#拼装成最终的json格式,echo输出得到最后结果\r\nreturnResult','Mysql55-shell脚本','Mysql55和shell脚本结合评测','2018-05-10 15:12:00','2018-07-23 14:21:30'),(43,97,'#!/bin/bash\r\ncd WORKSPACE\r\n# 待编译的评测文件\r\nchallengeProgramNames=(CHALLENGEPROGRAMNAMES)\r\n# 待执行的评测文件(可能是编译所得的可执行文件,请按实际情况填写)\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 编译命令\r\ncompileCommand=\"javac -encoding UTF-8 -Djava.ext.dirs=./lib/ -sourcepath src/ -d target/\"\r\n# 执行命令\r\nexecuteCommand=\"java -Dfile.encoding=UTF-8 -Djava.ext.dirs=./lib/ -cp target/\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\n# 限制每个shell连接所能写文件的最大容量\r\necho \'ulimit -f 10000\' >>/root/.bashrc ; source /root/.bashrc\r\n\r\n# 编译函数\r\ncompile(){\r\n # 创建target目录\r\n mkdir target &> /dev/null\r\n # 当前关卡的编译目标文件\r\n challengeProgramName=${challengeProgramNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n # 删除上一次编译生成的文件,防止对本次编译造成影响\r\n rm -f ./target/step$challengeStage/*.class &> /dev/null\r\n \r\n # 获取编译结果(此处编译无输出则说明编译通过,否则输出编译错误信息,请按实训实际情况调整)\r\n compileResult=$($compileCommand $challengeProgramName 2>&1 | base64)\r\n if [ -z \"$compileResult\" ]; then\r\n compileResult=$(echo -n \"compile successfully\" | base64)\r\n fi\r\n\r\n}\r\ncompile $1\r\n\r\n# 执行函数\r\nexecute(){\r\n # 循环检测数据库是否已启动\r\n while :;\r\n do\r\n sqlcmd -S localhost -U sa -P \'<123123Aa!@>\' -Q \"SELECT Name from sys.Databases\" 2>&1 >/dev/null\r\n if [ $? -eq 0 ];then\r\n break\r\n else\r\n sleep 1\r\n fi\r\n done\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n # 循环获取各测试用例下的实际输出\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n # 拼接执行结果\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\nexecute $1\r\n\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output}\"\r\n echo $result\r\n}\r\nreturnResult\r\n\r\n','Sqlserver/Java','java代码执行sqlserver操作','2018-05-25 15:30:11','2018-05-25 15:30:11'),(44,97,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待执行的评测文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 执行命令\r\nexecuteCommand=\"bash \"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2; OLD_IFS=\"$IFS\"; IFS=,; ins=($input); IFS=\"$OLD_IFS\"\r\n\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\n\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n # 循环检测数据库是否已启动\r\n while :;\r\n do\r\n sqlcmd -S localhost -U sa -P \'<123123Aa!@>\' -Q \"SELECT Name from sys.Databases\" 2>&1 >/dev/null\r\n if [ $? -eq 0 ];then\r\n break\r\n else\r\n sleep 1\r\n fi\r\n done\r\n # 循环获取各测试用例下的实际输出\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName | tr -s \' \' |tr \' \' \'\\t\' 2>&1 | base64)\r\n #拼接输出结果\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\nexecute $1\r\n\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output}\"\r\n echo $result\r\n}\r\nreturnResult','Sqlserver/Shell','','2018-06-12 17:10:44','2018-06-12 17:25:07'),(45,102,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待执行的评测文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 执行命令\r\nexecuteCommand=\"bash\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\n\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n \r\n # 循环获取各测试用例下的实际输出\r\n res_usage=\"{\\\"testSetUsages\\\":[\"\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes\r\n startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n # 拼接输出结果\r\n endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n let testSetCpuUsage=$endCpuUsage-$startCpuUsage\r\n maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)\r\n res_usage=\"$res_usage{\\\"testSetTime\\\":\\\"$testSetCpuUsage\\\",\\\"testSetMem\\\":\\\"$maxMemUsage\\\"},\"\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\n\r\nexecute $1\r\nres_usage=\"${res_usage::-1}\"\r\nres_usage=\"$res_usage]}\"\r\nres_usage=$(echo -ne \"$res_usage\"|base64)\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output,\\\"resUsage\\\":\\\"$res_usage\\\"}\"\r\n echo $result\r\n}\r\nreturnResult','Shell/Hadoop','Shell标准脚本','2018-06-15 16:52:37','2019-07-19 15:47:05'),(46,7,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待执行的评测文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 执行命令\r\nexecuteCommand=\"bash\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\n\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n \r\n # 循环获取各测试用例下的实际输出\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n # 拼接输出结果\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\n\r\nexecute $1\r\n\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output}\"\r\n echo $result\r\n}\r\nreturnResult','Hadoop/Shell','使用shell评测','2018-07-10 09:07:17','2018-07-10 09:07:17'),(47,2,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待执行的评测文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 执行命令\r\nexecuteCommand=\"bash\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\n\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n \r\n # 循环获取各测试用例下的实际输出\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n # 拼接输出结果\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\n\r\nexecute $1\r\n\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output}\"\r\n echo $result\r\n}\r\nreturnResult','Python3.6/Shell','Shell评测脚本','2018-07-16 11:28:41','2018-07-16 11:28:41'),(48,7,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待编译的评测文件\r\nchallengeProgramNames=(CHALLENGEPROGRAMNAMES)\r\n# 待执行的评测文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\n# 编译函数\r\ncompile(){\r\n cd step$1\r\n # 编译命令\r\n compileCommand=\"/apache-ant-1.10.1/bin/ant -q -S\"\r\n # 取当前关卡的编译文件\r\n challengeProgramName=${challengeProgramNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n############################################\r\n\r\n compileResult=$($compileCommand 2>&1)\r\n echo $compileResult |grep \'BUILD FAILED\' >/dev/null\r\n if [[ $? == 0 ]]; then\r\n compileResult=$(echo -n $compileResult | base64)\r\n else\r\n compileResult=$(echo -n \"compile successfully\" | base64)\r\n fi\r\n\r\n}\r\ncompile $1\r\n\r\nexecute(){\r\n # 执行命令\r\n executeCommand=\"sh $1.sh\"\r\n # 执行文件名\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n # 循环获取各测试用例下的实际输出\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n # 拼接输出结果\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\n\r\nexecute $1\r\n\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output}\"\r\n echo $result\r\n}\r\nreturnResult\r\n\r\n','Hadoop/v2.0','优化了评测脚本输出报错信息','2018-08-02 09:36:26','2018-08-02 09:36:26'),(49,104,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待执行的评测文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 执行命令\r\nexecuteCommand=\"python\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2; OLD_IFS=\"$IFS\"; IFS=,; ins=($input); IFS=\"$OLD_IFS\"\r\n\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\n\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n # 循环获取各测试用例下的实际输出\r\n res_usage=\"{\\\"testSetUsages\\\":[\"\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes\r\n startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n #拼接输出结果\r\n endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n let testSetCpuUsage=$endCpuUsage-$startCpuUsage\r\n maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)\r\n res_usage=\"$res_usage{\\\"testSetTime\\\":\\\"$testSetCpuUsage\\\",\\\"testSetMem\\\":\\\"$maxMemUsage\\\"},\"\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\nexecute $1\r\nres_usage=\"${res_usage::-1}\"\r\nres_usage=\"$res_usage]}\"\r\nres_usage=$(echo -ne \"$res_usage\"|base64)\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output,\\\"resUsage\\\":\\\"$res_usage\\\"}\"\r\n echo $result\r\n}\r\nreturnResult','Mongo/Python','python3评测','2018-08-02 15:33:19','2019-07-19 14:45:30'),(50,104,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待执行的评测文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 执行命令\r\nexecuteCommand=\"bash\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\n\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n \r\n # 循环获取各测试用例下的实际输出\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n # 拼接输出结果\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\n\r\nexecute $1\r\n\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output}\"\r\n echo $result\r\n}\r\nreturnResult','Mongo/Shell','shell脚本评测','2018-08-02 15:33:53','2018-08-02 15:33:53'),(54,106,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待执行的评测文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 执行命令\r\nexecuteCommand=\"bash\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\n\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n \r\n # 循环获取各测试用例下的实际输出\r\n res_usage=\"{\\\"testSetUsages\\\":[\"\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes\r\n startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n # 拼接输出结果\r\n endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n let testSetCpuUsage=$endCpuUsage-$startCpuUsage\r\n maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)\r\n res_usage=\"$res_usage{\\\"testSetTime\\\":\\\"$testSetCpuUsage\\\",\\\"testSetMem\\\":\\\"$maxMemUsage\\\"},\"\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\n\r\nexecute $1\r\nres_usage=\"${res_usage::-1}\"\r\nres_usage=\"$res_usage]}\"\r\nres_usage=$(echo -ne \"$res_usage\"|base64)\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output,\\\"resUsage\\\":\\\"$res_usage\\\"}\"\r\n echo $result\r\n}\r\nreturnResult','Python3-vnc/Shell','shell','2018-09-10 09:11:01','2019-07-19 15:20:06'),(55,22,'#!/bin/bash\r\ncd WORKSPACE/verifycode\r\nsourceClassNames=(\"com.servlet.CodeTest.txt\" \"com.servlet.LoginTest.txt\" \"com.servlet.CaptchaTest.txt\")\r\nOLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\nstartJetty(){\r\n nohup mvn jetty:run-war &> /dev/null &\r\n}\r\n\r\nrestartJetty(){\r\n rm nohup.out\r\n mvn jetty:stop &> nohup.out\r\n startJetty \r\n while :;\r\n do\r\n sleep 1\r\n netstat -antplu |grep 8080 &> /dev/null\r\n if [ $? -eq 0 ]\r\n then\r\n break\r\n fi\r\n done\r\n}\r\n\r\ncompile(){\r\n compileCommand=\"mvn compiler:compile\"\r\n\r\n compileResult=$($compileCommand 2>&1)\r\n if [[ $(echo $?) -ne 0 ]]; then\r\n compileResult=$(echo -n $compileResult | base64)\r\n else\r\n compileResult=$(echo -n \"compile successfully\" | base64)\r\n restartJetty\r\n fi\r\n}\r\n\r\ncompile\r\n\r\nexecute(){\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n executeCommand=\"echo $(awk -F \',\' \'{print $2 $3}\' target/surefire-reports/\"${sourceClassName}\" ) \"\r\n output=\'\'\r\n #执行,并拼接执行结果\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand 2>&1 | base64)\r\n #拼接输出结果\r\n output=$output\\\"$result\\\",\r\n output=\"[${output%?}]\"\r\n}\r\n\r\nexecute $1\r\n\r\n#return result in json format\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output}\"\r\n echo $result\r\n}\r\nreturnResult','Mvn/Jetty','Mvn/Jetty','2018-09-17 15:40:14','2018-09-17 15:40:14'),(56,107,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待执行的评测文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 执行命令\r\nexecuteCommand=\"python\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2; OLD_IFS=\"$IFS\"; IFS=,; ins=($input); IFS=\"$OLD_IFS\"\r\n\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\n\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n # 循环获取各测试用例下的实际输出\r\n res_usage=\"{\\\"testSetUsages\\\":[\"\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes\r\n startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n #拼接输出结果\r\n endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n let testSetCpuUsage=$endCpuUsage-$startCpuUsage\r\n maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)\r\n res_usage=\"$res_usage{\\\"testSetTime\\\":\\\"$testSetCpuUsage\\\",\\\"testSetMem\\\":\\\"$maxMemUsage\\\"},\"\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\nexecute $1\r\nres_usage=\"${res_usage::-1}\"\r\nres_usage=\"$res_usage]}\"\r\nres_usage=$(echo -ne \"$res_usage\"|base64)\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output,\\\"resUsage\\\":\\\"$res_usage\\\"}\"\r\n echo $result\r\n}\r\nreturnResult','python','','2018-10-29 10:25:27','2019-07-19 15:15:57'),(57,108,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待执行的评测文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 执行命令\r\nexecuteCommand=\"bash\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\n\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n \r\n # 循环获取各测试用例下的实际输出\r\n res_usage=\"{\\\"testSetUsages\\\":[\"\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes\r\n startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n # 拼接输出结果\r\n endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n let testSetCpuUsage=$endCpuUsage-$startCpuUsage\r\n maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)\r\n res_usage=\"$res_usage{\\\"testSetTime\\\":\\\"$testSetCpuUsage\\\",\\\"testSetMem\\\":\\\"$maxMemUsage\\\"},\"\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\n\r\nexecute $1\r\nres_usage=\"${res_usage::-1}\"\r\nres_usage=\"$res_usage]}\"\r\nres_usage=$(echo -ne \"$res_usage\"|base64)\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output,\\\"resUsage\\\":\\\"$res_usage\\\"}\"\r\n echo $result\r\n}\r\nreturnResult','Hbase/shell','使用shell评测','2018-11-14 13:18:24','2019-07-19 11:40:27'),(58,109,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待执行的评测文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 执行命令\r\nexecuteCommand=\"bash\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\n\r\n# 执行函数\r\nexecute(){\r\n \r\n while :;\r\n do\r\n sudo -u postgres psql -c \"\\dt\" 2>&1 > /dev/null 2>&1 >/dev/null\r\n if [ $? -eq 0 ];then\r\n break\r\n else\r\n sleep 1\r\n fi\r\n done\r\n \r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n \r\n # 循环获取各测试用例下的实际输出\r\n res_usage=\"{\\\"testSetUsages\\\":[\"\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes\r\n startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n # 拼接输出结果\r\n endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n let testSetCpuUsage=$endCpuUsage-$startCpuUsage\r\n maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)\r\n res_usage=\"$res_usage{\\\"testSetTime\\\":\\\"$testSetCpuUsage\\\",\\\"testSetMem\\\":\\\"$maxMemUsage\\\"},\"\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\n\r\nexecute $1\r\nres_usage=\"${res_usage::-1}\"\r\nres_usage=\"$res_usage]}\"\r\nres_usage=$(echo -ne \"$res_usage\"|base64)\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output,\\\"resUsage\\\":\\\"$res_usage\\\"}\"\r\n echo $result\r\n}\r\nreturnResult','PostgreSql/Shell','','2018-11-15 12:16:46','2019-07-19 15:06:01'),(59,110,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待执行的评测文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 执行命令\r\nexecuteCommand=\"bash\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\n\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n \r\n # 循环获取各测试用例下的实际输出\r\n res_usage=\"{\\\"testSetUsages\\\":[\"\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes\r\n startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n # 拼接输出结果\r\n endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n let testSetCpuUsage=$endCpuUsage-$startCpuUsage\r\n maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)\r\n res_usage=\"$res_usage{\\\"testSetTime\\\":\\\"$testSetCpuUsage\\\",\\\"testSetMem\\\":\\\"$maxMemUsage\\\"},\"\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\n\r\nexecute $1\r\nres_usage=\"${res_usage::-1}\"\r\nres_usage=\"$res_usage]}\"\r\nres_usage=$(echo -ne \"$res_usage\"|base64)\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output,\\\"resUsage\\\":\\\"$res_usage\\\"}\"\r\n echo $result\r\n}\r\nreturnResult','Hbase2/shell','','2018-11-18 15:28:30','2019-07-19 14:12:12'),(60,111,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待执行的评测文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 执行命令\r\nexecuteCommand=\"bash\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\n\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n \r\n # 循环获取各测试用例下的实际输出\r\n res_usage=\"{\\\"testSetUsages\\\":[\"\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes\r\n startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n # 拼接输出结果\r\n endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n let testSetCpuUsage=$endCpuUsage-$startCpuUsage\r\n maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)\r\n res_usage=\"$res_usage{\\\"testSetTime\\\":\\\"$testSetCpuUsage\\\",\\\"testSetMem\\\":\\\"$maxMemUsage\\\"},\"\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\n\r\nexecute $1\r\nres_usage=\"${res_usage::-1}\"\r\nres_usage=\"$res_usage]}\"\r\nres_usage=$(echo -ne \"$res_usage\"|base64)\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output,\\\"resUsage\\\":\\\"$res_usage\\\"}\"\r\n echo $result\r\n}\r\nreturnResult','Hbase-simple/Shell','','2018-11-30 15:11:45','2019-07-19 14:10:00'),(61,29,'#!/bin/bash\r\ncd WORKSPACE\r\n# 待编译的评测文件\r\nchallengeProgramNames=(CHALLENGEPROGRAMNAMES)\r\n# 待执行的评测文件(可能是编译所得的可执行文件,请按实际情况填写)\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 编译命令\r\ncompileCommand=\"scalac -encoding UTF-8 -sourcepath src/ -d target/\"\r\n# 执行命令\r\nexecuteCommand=\"scala -Dfile.encoding=UTF-8 -cp target/\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\n# 限制每个shell连接所能写文件的最大容量\r\necho \'ulimit -f 10000\' >>/root/.bashrc ; source /root/.bashrc\r\n\r\n# 编译函数\r\ncompile(){\r\n # 创建target目录\r\n mkdir target &> /dev/null\r\n # 当前关卡的编译目标文件\r\n challengeProgramName=${challengeProgramNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n # 删除上一次编译生成的文件,防止对本次编译造成影响\r\n rm -rf ./target/** &> /dev/null\r\n \r\n # 获取编译结果(此处编译无输出则说明编译通过,否则输出编译错误信息,请按实训实际情况调整)\r\n compileResult=$($compileCommand $challengeProgramName 2>&1 | base64)\r\n if [ -z \"$compileResult\" ]; then\r\n compileResult=$(echo -n \"compile successfully\" | base64)\r\n fi\r\n\r\n}\r\ncompile $1\r\n\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n # 循环获取各测试用例下的实际输出\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n # 拼接执行结果\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\nexecute $1\r\n\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output}\"\r\n echo $result\r\n}\r\nreturnResult\r\n\r\n','Scala','','2018-12-09 16:26:59','2018-12-10 16:19:29'),(62,112,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待执行的评测文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 执行命令\r\nexecuteCommand=\"bash\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\n\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n \r\n # 循环获取各测试用例下的实际输出\r\n res_usage=\"{\\\"testSetUsages\\\":[\"\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes\r\n startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n # 拼接输出结果\r\n endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n let testSetCpuUsage=$endCpuUsage-$startCpuUsage\r\n maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)\r\n res_usage=\"$res_usage{\\\"testSetTime\\\":\\\"$testSetCpuUsage\\\",\\\"testSetMem\\\":\\\"$maxMemUsage\\\"},\"\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\n\r\nexecute $1\r\nres_usage=\"${res_usage::-1}\"\r\nres_usage=\"$res_usage]}\"\r\nres_usage=$(echo -ne \"$res_usage\"|base64)\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output,\\\"resUsage\\\":\\\"$res_usage\\\"}\"\r\n echo $result\r\n}\r\nreturnResult','Sqoop/shell','','2018-12-18 09:22:55','2019-07-19 15:41:44'),(63,114,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\nchallengeProgramNames=(CHALLENGEPROGRAMNAMES)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\necho \'ulimit -f 1000000\' >>/root/.bashrc ; source /root/.bashrc\r\n\r\ncompile(){\r\n #example编译命令:nasm -f elf64 hello.asm\r\n compileCommand=\"nasm -f elf64 \"\r\n challengeProgramName_only=${challengeProgramNames[$1 - 1]}\r\n #remove the executeFile.out file that last time remains\r\n rm -f ./executeFile.out &> /dev/null\r\n rm -f ./executeFile1.out &> /dev/null\r\n \r\n #compile all .s file in the source folder: a/b/c.s --> a/b/*.s\r\n challengeProgramName=${challengeProgramName_only%/*.s}\"/*.s\"\r\n\r\n # 获取编译结果(此处编译无输出则说明编译通过,否则输出编译错误信息,请按实训实际情况调整)\r\n compileResult=$($compileCommand $challengeProgramName -o executeFile1.out 2>&1 | base64)\r\n \r\n if [ -z \"$compileResult\" ]; then\r\n compileResult=$(echo -n \"compile successfully\" | base64)\r\n fi \r\n \r\n #example编译命令:ld -s hello -o hello.o \r\n compileResult=$(ld -s executeFile1.out -o executeFile.out 2>&1 | base64)\r\n # 获取编译结果(此处编译无输出则说明编译通过,否则输出编译错误信息,请按实训实际情况调整)\r\n\r\n if [ -z \"$compileResult\" ]; then\r\n compileResult1=$(echo -n \"compile successfully\" | base64)\r\n fi\r\n \r\n}\r\ncompile $1\r\n\r\n\r\nexecute(){\r\n executeCommand=\"./executeFile.out\"\r\n challengeStage=$1\r\n \r\n #get the loop times(looptimes = the num of testdataset)\r\n res_usage=\"{\\\"testSetUsages\\\":[\"\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes\r\n startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n #执行,并拼接执行结果\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand | base64)\r\n #拼接输出结果\r\n endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n let testSetCpuUsage=$endCpuUsage-$startCpuUsage\r\n maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)\r\n res_usage=\"$res_usage{\\\"testSetTime\\\":\\\"$testSetCpuUsage\\\",\\\"testSetMem\\\":\\\"$maxMemUsage\\\"},\"\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\n\r\nexecute $1\r\nres_usage=\"${res_usage::-1}\"\r\nres_usage=\"$res_usage]}\"\r\nres_usage=$(echo -ne \"$res_usage\"|base64)\r\n#return result in json format\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output,\\\"resUsage\\\":\\\"$res_usage\\\"}\"\r\n echo $result\r\n}\r\n#拼装成最终的json格式,echo输出得到最后结果\r\nreturnResult','Nasm/shell','','2019-02-18 17:14:35','2019-07-19 14:50:52'),(64,34,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待执行的评测文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 执行命令\r\nexecuteCommand=\"python\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2; OLD_IFS=\"$IFS\"; IFS=,; ins=($input); IFS=\"$OLD_IFS\"\r\n\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\n\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n # 循环获取各测试用例下的实际输出\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n #拼接输出结果\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\nexecute $1\r\n\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output}\"\r\n echo $result\r\n}\r\nreturnResult','Docker/python脚本','使用Python脚本进行评测。','2019-02-22 14:23:47','2019-02-22 14:23:47'),(66,5,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待执行的评测文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 执行命令\r\nexecuteCommand=\"bash\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\n\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n \r\n # 循环获取各测试用例下的实际输出\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n # 拼接输出结果\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\n\r\nexecute $1\r\n\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output}\"\r\n echo $result\r\n}\r\nreturnResult','Java/Shell','Shell评测脚本','2019-03-07 16:14:54','2019-03-12 16:36:52'),(68,116,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待执行的评测文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 执行命令\r\nexecuteCommand=\"bash\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\n\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n \r\n # 循环获取各测试用例下的实际输出\r\n res_usage=\"{\\\"testSetUsages\\\":[\"\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes\r\n startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n # 拼接输出结果\r\n endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n let testSetCpuUsage=$endCpuUsage-$startCpuUsage\r\n maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)\r\n res_usage=\"$res_usage{\\\"testSetTime\\\":\\\"$testSetCpuUsage\\\",\\\"testSetMem\\\":\\\"$maxMemUsage\\\"},\"\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\n\r\nexecute $1\r\nres_usage=\"${res_usage::-1}\"\r\nres_usage=\"$res_usage]}\"\r\nres_usage=$(echo -ne \"$res_usage\"|base64)\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output,\\\"resUsage\\\":\\\"$res_usage\\\"}\"\r\n echo $result\r\n}\r\nreturnResult','Python3-tentensorflow1.5/Shell','','2019-03-08 10:50:49','2019-07-19 15:17:55'),(69,116,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待执行的评测文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 执行命令\r\nexecuteCommand=\"python\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2; OLD_IFS=\"$IFS\"; IFS=,; ins=($input); IFS=\"$OLD_IFS\"\r\n\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\n\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n # 循环获取各测试用例下的实际输出\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n #拼接输出结果\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\nexecute $1\r\n\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output}\"\r\n echo $result\r\n}\r\nreturnResult','Python3-tentensorflow1.5','','2019-03-08 10:50:59','2019-03-08 10:50:59'),(71,22,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待执行的评测文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 执行命令\r\nexecuteCommand=\"bash\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\n\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n \r\n # 循环获取各测试用例下的实际输出\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n # 拼接输出结果\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\n\r\nexecute $1\r\n\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output}\"\r\n echo $result\r\n}\r\nreturnResult','JavaWeb/Shell','java shell脚本','2019-03-12 16:52:10','2019-03-12 16:52:10'),(73,13,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待执行的评测文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 执行命令\r\nexecuteCommand=\"bash\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\n\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n \r\n # 循环获取各测试用例下的实际输出\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n # 拼接输出结果\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\n\r\nexecute $1\r\n\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output}\"\r\n echo $result\r\n}\r\nreturnResult','C/Shell','shell脚本执行','2019-03-18 17:43:29','2019-03-18 17:43:29'),(74,118,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待执行的评测文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 执行命令\r\nexecuteCommand=\"bash\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\n\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n \r\n # 循环获取各测试用例下的实际输出\r\n res_usage=\"{\\\"testSetUsages\\\":[\"\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes\r\n startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n # 拼接输出结果\r\n endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n let testSetCpuUsage=$endCpuUsage-$startCpuUsage\r\n maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)\r\n res_usage=\"$res_usage{\\\"testSetTime\\\":\\\"$testSetCpuUsage\\\",\\\"testSetMem\\\":\\\"$maxMemUsage\\\"},\"\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\n\r\nexecute $1\r\nres_usage=\"${res_usage::-1}\"\r\nres_usage=\"$res_usage]}\"\r\nres_usage=$(echo -ne \"$res_usage\"|base64)\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output,\\\"resUsage\\\":\\\"$res_usage\\\"}\"\r\n echo $result\r\n}\r\nreturnResult','Kafka/Shell','','2019-03-20 17:35:42','2019-07-19 14:24:39'),(75,10,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待执行的评测文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 执行命令\r\nexecuteCommand=\"bash\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\n\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n # 循环获取各测试用例下的实际输出\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n # 拼接输出结果\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\nexecute $1\r\n\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output}\"\r\n echo $result\r\n}\r\nreturnResult','Matlab/Shell','','2019-03-25 10:07:54','2019-06-25 14:25:55'),(77,2,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待执行的评测文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 执行命令\r\nexecuteCommand=\"python\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2; OLD_IFS=\"$IFS\"; IFS=,; ins=($input); IFS=\"$OLD_IFS\"\r\n\r\n#启动php自建web服务器,端口为80\r\nrunserver(){\r\n pkill -f \"manage.py runserver\"\r\n lsof -i:8080 &> /dev/null\r\n if [ $? -eq 1 ]; then\r\n nohup python ${sourceClassNames[$1 - 1]} runserver 0.0.0.0:8080 &> /dev/null &\r\n fi\r\n while :;\r\n do\r\n sleep 1\r\n lsof -i:8080 &> /dev/null\r\n if [ $? -eq 0 ]\r\n then\r\n break\r\n fi\r\n done\r\n}\r\nrunserver $1\r\n\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\n\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n\r\n # 循环获取各测试用例下的实际输出\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName test apptest 2>&1)\r\n result=$(echo \"${result/in [0-9].[0-9][0-9][0-9]s}\" | base64)\r\n output=$output\\\"$result\\\", \r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\n\r\nexecute $1\r\n\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output}\"\r\n echo $result\r\n}\r\nreturnResult','Python3.6/Django','注意:请将以下第45行代码中的“apptese”修改为你自己项目的app名称!\r\n运行Django项目,运行项目后执行tests.py测试文件,请在项目的tests.py文件中写好测试代码。(运行测试代码时会去掉\"in 0.000s\"时间)','2019-04-12 17:06:00','2019-06-04 17:49:35'),(78,29,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待执行的评测文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 执行命令\r\nexecuteCommand=\"bash\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\n\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n \r\n # 循环获取各测试用例下的实际输出\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n # 拼接输出结果\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\n\r\nexecute $1\r\n\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output}\"\r\n echo $result\r\n}\r\nreturnResult','spark-shell','shell脚本','2019-04-22 10:26:39','2019-04-22 10:26:39'),(79,109,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待执行的评测文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 执行命令\r\nexecuteCommand=\"python\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2; OLD_IFS=\"$IFS\"; IFS=,; ins=($input); IFS=\"$OLD_IFS\"\r\n\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\n\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n # 循环获取各测试用例下的实际输出\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n #拼接输出结果\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\nexecute $1\r\n\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output}\"\r\n echo $result\r\n}\r\nreturnResult','PostgreSql/Python','','2019-05-07 15:28:55','2019-05-07 15:28:55'),(80,119,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待执行的评测文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 执行命令\r\nexecuteCommand=\"bash\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\n\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n \r\n # 循环获取各测试用例下的实际输出\r\n res_usage=\"{\\\"testSetUsages\\\":[\"\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes\r\n startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n # 拼接输出结果\r\n endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n let testSetCpuUsage=$endCpuUsage-$startCpuUsage\r\n maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)\r\n res_usage=\"$res_usage{\\\"testSetTime\\\":\\\"$testSetCpuUsage\\\",\\\"testSetMem\\\":\\\"$maxMemUsage\\\"},\"\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\n\r\nexecute $1\r\nres_usage=\"${res_usage::-1}\"\r\nres_usage=\"$res_usage]}\"\r\nres_usage=$(echo -ne \"$res_usage\"|base64)\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output,\\\"resUsage\\\":\\\"$res_usage\\\"}\"\r\n echo $result\r\n}\r\nreturnResult','Shell/vscode','','2019-05-29 17:43:47','2019-07-19 15:53:12'),(81,120,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\nchallengeProgramNames=(CHALLENGEPROGRAMNAMES)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\necho \'ulimit -f 1000000\' >>/root/.bashrc ; source /root/.bashrc\r\n\r\ncompile(){\r\n compileCommand=\"gcc -lm -lc -lz \"\r\n challengeProgramName=${challengeProgramNames[$1 - 1]}\r\n #remove the executeFile.out file that last time remains\r\n rm -f ./executeFile.out &> /dev/null\r\n\r\n #compile all .c file in the source folder: a/b/c.c --> a/b/*.c\r\n challengeProgramName=${challengeProgramName%/*.c}\"/*.c\"\r\n\r\n # 获取编译结果(此处编译无输出则说明编译通过,否则输出编译错误信息,请按实训实际情况调整)\r\n compileResult=$($compileCommand $challengeProgramName -o executeFile.out 2>&1 | base64)\r\n if [ -z \"$compileResult\" ]; then\r\n compileResult=$(echo -n \"compile successfully\" | base64)\r\n fi\r\n\r\n}\r\ncompile $1\r\n\r\n\r\nexecute(){\r\n executeCommand=\"./executeFile.out\"\r\n challengeStage=$1\r\n \r\n #get the loop times(looptimes = the num of testdataset)\r\n res_usage=\"{\\\"testSetUsages\\\":[\"\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes\r\n startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n #执行,并拼接执行结果\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand | base64)\r\n #拼接输出结果\r\n endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n let testSetCpuUsage=$endCpuUsage-$startCpuUsage\r\n maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)\r\n res_usage=\"$res_usage{\\\"testSetTime\\\":\\\"$testSetCpuUsage\\\",\\\"testSetMem\\\":\\\"$maxMemUsage\\\"},\"\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\n\r\nexecute $1\r\nres_usage=\"${res_usage::-1}\"\r\nres_usage=\"$res_usage]}\"\r\nres_usage=$(echo -ne \"$res_usage\"|base64)\r\n#return result in json format\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output,\\\"resUsage\\\":\\\"$res_usage\\\"}\"\r\n echo $result\r\n}\r\n#拼装成最终的json格式,echo输出得到最后结果\r\nreturnResult\r\n\r\n','GPU/C','','2019-06-05 17:48:14','2019-07-19 11:36:10'),(82,120,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\nchallengeProgramNames=(CHALLENGEPROGRAMNAMES)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\necho \'ulimit -f 1000000\' >>/root/.bashrc ; source /root/.bashrc\r\n\r\ncompile(){\r\n compileCommand=\"g++ \"\r\n challengeProgramName=${challengeProgramNames[$1 - 1]}\r\n #remove the executeFile.out file that last time remains\r\n rm -f ./executeFile.out &> /dev/null\r\n\r\n #compile all .c file in the source folder: a/b/c.cpp --> a/b/*.cpp\r\n challengeProgramName=${challengeProgramName%/*.cpp}\"/*.cpp\"\r\n\r\n # 获取编译结果(此处编译无输出则说明编译通过,否则输出编译错误信息,请按实训实际情况调整)\r\n compileResult=$($compileCommand $challengeProgramName -o executeFile.out 2>&1 | base64)\r\n if [ -z \"$compileResult\" ]; then\r\n compileResult=$(echo -n \"compile successfully\" | base64)\r\n fi\r\n\r\n}\r\ncompile $1\r\n\r\n\r\nexecute(){\r\n executeCommand=\"./executeFile.out\"\r\n challengeStage=$1\r\n \r\n #get the loop times(looptimes = the num of testdataset)\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n #执行,并拼接执行结果\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand | base64)\r\n #拼接输出结果\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\n\r\nexecute $1\r\n\r\n#return result in json format\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output}\"\r\n echo $result\r\n}\r\n#拼装成最终的json格式,echo输出得到最后结果\r\nreturnResult\r\n\r\n','GPU/C++','','2019-06-05 17:48:36','2019-06-05 17:48:36'),(83,120,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待执行的评测文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 执行命令\r\nexecuteCommand=\"bash\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\n\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n \r\n # 循环获取各测试用例下的实际输出\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n # 拼接输出结果\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\n\r\nexecute $1\r\n\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output}\"\r\n echo $result\r\n}\r\nreturnResult','GPU/C/Shell','','2019-06-05 17:48:57','2019-06-05 17:48:57'),(84,123,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待执行的评测文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 执行命令\r\nexecuteCommand=\"bash\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\n\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n \r\n # 循环获取各测试用例下的实际输出\r\n res_usage=\"{\\\"testSetUsages\\\":[\"\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes\r\n startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n # 拼接输出结果\r\n endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n let testSetCpuUsage=$endCpuUsage-$startCpuUsage\r\n maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)\r\n res_usage=\"$res_usage{\\\"testSetTime\\\":\\\"$testSetCpuUsage\\\",\\\"testSetMem\\\":\\\"$maxMemUsage\\\"},\"\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\n\r\nexecute $1\r\nres_usage=\"${res_usage::-1}\"\r\nres_usage=\"$res_usage]}\"\r\nres_usage=$(echo -ne \"$res_usage\"|base64)\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output,\\\"resUsage\\\":\\\"$res_usage\\\"}\"\r\n echo $result\r\n}\r\nreturnResult','Shell/Flink','','2019-06-17 16:19:57','2019-07-19 11:29:05'),(85,124,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待执行的评测文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 执行命令\r\nexecuteCommand=\"bash\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\n\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n # 循环获取各测试用例下的实际输出\r\n res_usage=\"{\\\"testSetUsages\\\":[\"\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes\r\n startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n # 拼接输出结果\r\n endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n let testSetCpuUsage=$endCpuUsage-$startCpuUsage\r\n maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)\r\n res_usage=\"$res_usage{\\\"testSetTime\\\":\\\"$testSetCpuUsage\\\",\\\"testSetMem\\\":\\\"$maxMemUsage\\\"},\"\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\nexecute $1\r\nres_usage=\"${res_usage::-1}\"\r\nres_usage=\"$res_usage]}\"\r\nres_usage=$(echo -ne \"$res_usage\"|base64)\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output,\\\"resUsage\\\":\\\"$res_usage\\\"}\"\r\n echo $result\r\n}\r\nreturnResult','Matlab-vnc/shell','','2019-06-25 14:26:19','2019-07-19 14:42:10'),(86,127,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待执行的评测文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 执行命令\r\nexecuteCommand=\"bash\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\n\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n \r\n # 循环获取各测试用例下的实际输出\r\n res_usage=\"{\\\"testSetUsages\\\":[\"\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes\r\n startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n # 拼接输出结果\r\n endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n let testSetCpuUsage=$endCpuUsage-$startCpuUsage\r\n maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)\r\n res_usage=\"$res_usage{\\\"testSetTime\\\":\\\"$testSetCpuUsage\\\",\\\"testSetMem\\\":\\\"$maxMemUsage\\\"},\"\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\n\r\nexecute $1 \r\nres_usage=\"${res_usage::-1}\"\r\nres_usage=\"$res_usage]}\"\r\nres_usage=$(echo -ne \"$res_usage\"|base64)\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output,\\\"resUsage\\\":\\\"$res_usage\\\"}\"\r\n echo $result\r\n}\r\nreturnResult','Shell/cisco','','2019-07-17 17:06:00','2019-07-19 13:54:05'),(87,115,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待执行的评测文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 执行命令\r\nexecuteCommand=\"bash\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\n\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n \r\n # 循环获取各测试用例下的实际输出\r\n res_usage=\"{\\\"testSetUsages\\\":[\"\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes\r\n startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n # 拼接输出结果\r\n endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n let testSetCpuUsage=$endCpuUsage-$startCpuUsage\r\n maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)\r\n res_usage=\"$res_usage{\\\"testSetTime\\\":\\\"$testSetCpuUsage\\\",\\\"testSetMem\\\":\\\"$maxMemUsage\\\"},\"\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\n\r\nexecute $1\r\nres_usage=\"${res_usage::-1}\"\r\nres_usage=\"$res_usage]}\"\r\nres_usage=$(echo -ne \"$res_usage\"|base64)\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output,\\\"resUsage\\\":\\\"$res_usage\\\"}\"\r\n echo $result\r\n}\r\nreturnResult','Python-Gpu/Shell','','2019-07-19 15:10:36','2019-07-19 15:13:52'),(88,NULL,NULL,NULL,NULL,'2019-08-13 16:46:05','2019-08-13 16:46:05'),(89,129,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待执行的评测文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 执行命令\r\nexecuteCommand=\"bash\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\n\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n \r\n # 循环获取各测试用例下的实际输出\r\n res_usage=\"{\\\"testSetUsages\\\":[\"\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes\r\n startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n # 拼接输出结果\r\n endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n let testSetCpuUsage=$endCpuUsage-$startCpuUsage\r\n maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)\r\n res_usage=\"$res_usage{\\\"testSetTime\\\":\\\"$testSetCpuUsage\\\",\\\"testSetMem\\\":\\\"$maxMemUsage\\\"},\"\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\n\r\nexecute $1\r\nres_usage=\"${res_usage::-1}\"\r\nres_usage=\"$res_usage]}\"\r\nres_usage=$(echo -ne \"$res_usage\"|base64)\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output,\\\"resUsage\\\":\\\"$res_usage\\\"}\"\r\n echo $result\r\n}\r\nreturnResult','Hbase-finish/Shell','','2019-08-13 16:47:52','2019-08-13 16:47:52'),(90,130,'#!/bin/bash\r\ncd WORKSPACE\r\n\r\n# 待执行的评测文件\r\nsourceClassNames=(SOURCECLASSNAMES)\r\n\r\n# 执行命令\r\nexecuteCommand=\"bash\"\r\n\r\n# 获取测试用例的输入(请勿改动此行语句)\r\ninput=$2;OLD_IFS=\"$IFS\"; IFS=,; ins=($input);IFS=\"$OLD_IFS\"\r\n\r\ncompileResult=$(echo -n \"compile successfully\" | base64)\r\n\r\n# 执行函数\r\nexecute(){\r\n # 当前关卡的执行目标文件\r\n sourceClassName=${sourceClassNames[$1 - 1]}\r\n # 当前关卡号\r\n challengeStage=$1\r\n \r\n # 循环获取各测试用例下的实际输出\r\n res_usage=\"{\\\"testSetUsages\\\":[\"\r\n output=\'\'\r\n i=0\r\n while [[ i -lt ${#ins[*]} ]]; do\r\n echo 0 > /sys/fs/cgroup/memory/memory.max_usage_in_bytes\r\n startCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n result=$(echo \"${ins[$i]}\" | base64 -d | $executeCommand $sourceClassName 2>&1 | base64)\r\n # 拼接输出结果\r\n endCpuUsage=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)\r\n let testSetCpuUsage=$endCpuUsage-$startCpuUsage\r\n maxMemUsage=$(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes)\r\n res_usage=\"$res_usage{\\\"testSetTime\\\":\\\"$testSetCpuUsage\\\",\\\"testSetMem\\\":\\\"$maxMemUsage\\\"},\"\r\n output=$output\\\"$result\\\",\r\n let i++\r\n done\r\n output=\"[${output%?}]\"\r\n}\r\n\r\nexecute $1\r\nres_usage=\"${res_usage::-1}\"\r\nres_usage=\"$res_usage]}\"\r\nres_usage=$(echo -ne \"$res_usage\"|base64)\r\n# 返回评测结果\r\nreturnResult(){\r\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output,\\\"resUsage\\\":\\\"$res_usage\\\"}\"\r\n echo $result\r\n}\r\nreturnResult','Hbase-nobug/Shell','','2019-08-30 16:41:42','2019-08-30 16:41:42'); /*!40000 ALTER TABLE `mirror_scripts` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `platform_samples` -- DROP TABLE IF EXISTS `platform_samples`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; 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; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `platform_samples` -- LOCK TABLES `platform_samples` WRITE; /*!40000 ALTER TABLE `platform_samples` DISABLE KEYS */; INSERT INTO `platform_samples` VALUES (1,'taskPass','[TOC]\r\n\r\n---\r\n\r\n####任务描述\r\n\r\n\r\n本关任务:编写一个能计算数组平均值和最大值的小程序。\r\n\r\n\r\n####相关知识\r\n\r\n\r\n为了完成本关任务,你需要掌握:1.如何获取数组的长度,2.如何遍历数组。\r\n\r\n#####获取数组的长度\r\n数组的`length`属性用于记录数组中有多少个元素或存储单元,即记录数组的长度是多少。\r\n```java\r\nint[] nums = new int[10];//声明一个int型数组并动态初始化其大小为10\r\n\r\nSystem.out.println(nums.length);//显示当前数组的大小\r\n```\r\n输出:`10`\r\n\r\n#####遍历数组\r\n通俗的理解,遍历数组就是:**把数组中的元素都看一遍**。\r\n\r\n示例如下:\r\n```java\r\nint[] arr = {1,3,5,7,9};\r\nfor(int i = 0 ; i&1 | base64)\n # 拼接输出结果\n output=$output\\\"$result\\\",\n let i++\n done\n output=\"[${output%?}]\"\n}\nexecute $1\n\n# 返回评测结果\nreturnResult(){\n result=\"{\\\"compileResult\\\":\\\"$compileResult\\\",\\\"out\\\":$output}\"\n echo $result\n}\nreturnResult','2018-01-29 16:21:11','2018-02-01 14:36:37'),(3,'introduction','[comment]: <> (请在此添加实训简介,简单介绍一下实训的内容.以下是“基于Java语言的链表编程实训(基础篇)”实训的示例文:)\r\n\r\n链表(Linked List)是一种通用的数据结构,主要用于表示和管理数量不确定的数据。链表可有效解决数组(Array)在动态数据管理方面的不足。\r\n\r\n本实训项目的主要内容是基于Java语言开发一个具有基本功能的单链表,从六个方面介绍链表相关知识,并设置了六个关卡在线考察大家的链表编程能力。\r\n\r\n![](/api/attachments/169735)','2018-02-07 17:02:53','2018-02-07 17:02:53'),(4,'knowledge','[comment]: <> (请在此添加实训历史背景、应用背景拓展学员视野.以下是“基于Java语言的链表编程实训(基础篇)”实训的示例:)\r\n\r\n#### 链表的历史\r\n1955至1956年间,链表由Allen Newell、Cliff Shaw和Herbert A. Simon首次提出,当时他们正在开发一种信息处理语言(IPL)。该IPL项目由美国兰德公司(RAND Corporation)资助。IPL随后被用于开发了几个早期的人工智能程序,包括逻辑理论机(Logic Theory Machine)、通用问题求解器(General Problem Solver)和计算机下棋程序。\r\n![](/api/attachments/169231)\r\n1975年,Newell和Simon被授予计算机领域的最高奖—图灵奖(ACM Turing Award),表彰他们“为人工智能、人类认知心理学,以及链表处理做出了基础性贡献”。\r\n\r\n#### 链表的适用范围和基本原理\r\n现实世界中的大量数据都可以用链表来建模,但并不是所有类型的数据处理过程都适合用链表来实现。一般而言,适合用链表来表示和管理数据具有以下特点:\r\n- 数据的数量是持续变化的\r\n- 数据的数量上限难以估计,而且通常很大\r\n- 不需要按照序号对数据进行随机访问\r\n\r\n#### 链表的分类\r\n- 单链表\r\n单链表(Singly Linked List)是通过每个节点的指针指向下一个节点从而链接起来的链表结构,最后一个节点的next指向null,如下图。\r\n![](/api/attachments/169232)\r\n\r\n- 双链表\r\n双链表(Doubly Linked List)是包含两个指针的,pre指向前一个节点,next指向后一个节点,其中第一个节点head的pre指向null,最后一个节点的tail指向null,如下图。\r\n![](/api/attachments/169233)\r\n\r\n- 循环列表\r\n循环链表(Circular Linked List)的全称是双向循环链表,和双向链表的不同在于,循环链表第一个节点的pre指向最后一个节点,最后一个节点的next指向第一个节点,形成一个“环”,如下图。\r\n![](/api/attachments/169234)\r\n\r\n####链表与数组的对比\r\n链表、数组和动态数组具有不同的内存管理方式。数组在内存中占用连续的内存空间,而链表则是每个节点占用一块空间。因此,滥用链表会导致内存碎片化问题。下图是链表、数组、动态数组之间的若干计算性质的对比:\r\n![](/api/attachments/169235)\r\n\r\n动态数组则是预先分配适量内存,后续使用过程不够时再重新分配更大的内存。但重新分配内存的过程往往会拷贝所有元素,代价较大。\r\n\r\n链表是大家学习计算机编程、算法设计时经常用到的基本数据结构,完成了本次实训,大家将在这方面打下坚实的基础,非常有助于后续的提升。\r\n\r\n#### 延伸阅读\r\n* 马克•艾伦•维斯 (Mark Allen Weiss), 数据结构与算法分析:Java语言描述(原书第3版), 机械工业出版社, 2016年3月1日\r\n* Wikipeida, Linked list https://en.wikipedia.org/wiki/Linked_list \r\n* 张凌, 链表是做什么用的, 知乎, https://www.zhihu.com/question/19773378\r\n','2018-02-07 17:03:17','2018-02-07 17:03:17'),(5,'courseGuide','大家好!\n\n欢迎进入在线课堂!\n\n该课堂对应于一个或多个线下班级,课堂成员可以利用老师发布的邀请码申请加入。\n\n在这里,老师和教辅将结合教学内容,把不同类型的实训项目发布给大家,让大家在真实的实战环境中得到锻炼。\n\n那么什么是实训项目呢?大家有空自己尝试一下就知道了:\n\n- Python实训:[Python程序设计入门](https://www.educoder.net/paths/13) | [大学计算机基础——基于Python](https://www.educoder.net/paths/11)\n\n- Java实训:[Java语言程序设计(基础篇)](https://www.educoder.net/paths/38)\n\n- C/C++实训:[C/C++程序设计](https://www.educoder.net/paths/3) | [数据结构与算法(C语言)](https://www.educoder.net/paths/4)\n\n- Matlab实训:[智取MATLAB:基本语法](https://www.educoder.net/shixuns/7bvs54gw/challenges) | [控制结构](https://www.educoder.net/shixuns/q4fowkfa/challenges) | [矩阵进阶](https://www.educoder.net/shixuns/grunzcs3/challenges)\n\n- HTML/CSS实训:[HTML5+CSS3网页制作(基础篇)](https://www.educoder.net/paths/15)\n\n- 云计算实训:[Docker企业级实训(基础篇)](https://www.educoder.net/paths/29)\n\n... ... 等等\n\n你们现在就可以去体验哦!\n\n欢迎提出宝贵建议,平台一定会给您带来更多惊喜!\n\n\n支持团队','2018-04-20 09:10:16','2018-04-20 09:10:16'); /*!40000 ALTER TABLE `platform_samples` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `edu_settings` -- DROP TABLE IF EXISTS `edu_settings`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; 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=34 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `edu_settings` -- LOCK TABLES `edu_settings` WRITE; /*!40000 ALTER TABLE `edu_settings` DISABLE KEYS */; INSERT INTO `edu_settings` VALUES (1,'tomcat_webssh','http://172.16.94.243:8890','2019-06-21 09:38:31','2019-08-23 23:48:47',NULL),(2,'webssh_username','root','2019-06-21 09:38:31','2019-08-23 22:26:14',NULL),(3,'webssh_password','123123','2019-06-21 09:38:31','2019-08-23 22:26:22',NULL),(4,'git_address_ip','http://172.16.94.154:9000','2019-06-21 09:38:31','2019-08-23 21:45:11',NULL),(5,'git_address_domain','https://git.educoder.net','2019-06-21 09:38:31','2019-08-23 22:18:10',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','http://www.educoder.net','2019-06-21 09:38:31','2019-07-20 22:36:27',NULL),(12,'public_cdn_host','http://cdn.educoder.net','2019-06-21 09:38:31','2019-08-23 22:43:02',NULL),(13,'cloud_bridge','http://172.16.94.243:8890','2019-06-21 09:38:31','2019-08-23 23:10:48',NULL),(14,'cloud_tomcat_php','http://47.96.157.89','2019-06-21 09:38:31','2019-08-23 21:45:40',NULL),(15,'host_name','https://www.educoder.net','2019-06-21 09:38:31','2019-07-20 22:36:37',NULL),(16,'old_edu_host','https://forge.educoder.net','2019-06-21 09:38:31','2019-07-20 12:56: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','https://www.educoder.net ','2019-06-21 10:57:28','2019-07-22 14:00:54',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-23 21:46:16',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),(33,'es_highlight_fragment_size','80','2019-08-14 17:02:22','2019-08-14 17:04:40',NULL); /*!40000 ALTER TABLE `edu_settings` ENABLE KEYS */; UNLOCK TABLES; SET @@SESSION.SQL_LOG_BIN = @MYSQLDUMP_TEMP_LOG_BIN; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -- Dump completed on 2019-09-03 11:29:50