dead test & clean-up
This commit is contained in:
parent
cc115d651f
commit
2117738d13
Binary file not shown.
|
@ -18,13 +18,12 @@ import java.util.*;
|
||||||
*/
|
*/
|
||||||
public class ConfigDefinition {
|
public class ConfigDefinition {
|
||||||
static final String SIGNATURE_HASH = "SIGNATURE_HASH";
|
static final String SIGNATURE_HASH = "SIGNATURE_HASH";
|
||||||
private static String TS_OUTPUTS_DESTINATION = null;
|
|
||||||
public static String MESSAGE;
|
public static String MESSAGE;
|
||||||
|
|
||||||
private static final String ROM_RAIDER_XML_TEMPLATE = "rusefi_template.xml";
|
private static final String ROM_RAIDER_XML_TEMPLATE = "rusefi_template.xml";
|
||||||
public static final String KEY_DEFINITION = "-definition";
|
private static final String KEY_DEFINITION = "-definition";
|
||||||
private static final String KEY_ROMRAIDER_INPUT = "-romraider";
|
private static final String KEY_ROMRAIDER_INPUT = "-romraider";
|
||||||
public static final String KEY_TS_DESTINATION = "-ts_destination";
|
private static final String KEY_TS_DESTINATION = "-ts_destination";
|
||||||
private static final String KEY_C_DESTINATION = "-c_destination";
|
private static final String KEY_C_DESTINATION = "-c_destination";
|
||||||
private static final String KEY_C_DEFINES = "-c_defines";
|
private static final String KEY_C_DEFINES = "-c_defines";
|
||||||
/**
|
/**
|
||||||
|
@ -34,9 +33,9 @@ public class ConfigDefinition {
|
||||||
private static final String KEY_JAVA_DESTINATION = "-java_destination";
|
private static final String KEY_JAVA_DESTINATION = "-java_destination";
|
||||||
private static final String KEY_ROMRAIDER_DESTINATION = "-romraider_destination";
|
private static final String KEY_ROMRAIDER_DESTINATION = "-romraider_destination";
|
||||||
private static final String KEY_FIRING = "-firing_order";
|
private static final String KEY_FIRING = "-firing_order";
|
||||||
public static final String KEY_PREPEND = "-prepend";
|
private static final String KEY_PREPEND = "-prepend";
|
||||||
public static final String KEY_SIGNATURE = "-signature";
|
private static final String KEY_SIGNATURE = "-signature";
|
||||||
public static final String KEY_SIGNATURE_DESTINATION = "-signature_destination";
|
private static final String KEY_SIGNATURE_DESTINATION = "-signature_destination";
|
||||||
private static final String KEY_ZERO_INIT = "-initialize_to_zero";
|
private static final String KEY_ZERO_INIT = "-initialize_to_zero";
|
||||||
private static final String KEY_BOARD_NAME = "-board";
|
private static final String KEY_BOARD_NAME = "-board";
|
||||||
/**
|
/**
|
||||||
|
@ -45,7 +44,6 @@ public class ConfigDefinition {
|
||||||
* This could be related to configuration header use-case versus "live data" (not very alive idea) use-case
|
* This could be related to configuration header use-case versus "live data" (not very alive idea) use-case
|
||||||
*/
|
*/
|
||||||
public static boolean needZeroInit = true;
|
public static boolean needZeroInit = true;
|
||||||
public static String definitionInputFile = null;
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
try {
|
try {
|
||||||
|
@ -73,7 +71,6 @@ public class ConfigDefinition {
|
||||||
SystemOut.println(ConfigDefinition.class + " Invoked with " + Arrays.toString(args));
|
SystemOut.println(ConfigDefinition.class + " Invoked with " + Arrays.toString(args));
|
||||||
|
|
||||||
String tsInputFileFolder = null;
|
String tsInputFileFolder = null;
|
||||||
String destCHeaderFileName = null;
|
|
||||||
String destCDefinesFileName = null;
|
String destCDefinesFileName = null;
|
||||||
String javaDestinationFileName = null;
|
String javaDestinationFileName = null;
|
||||||
String romRaiderDestination = null;
|
String romRaiderDestination = null;
|
||||||
|
@ -86,6 +83,8 @@ public class ConfigDefinition {
|
||||||
List<String> enumInputFiles = new ArrayList<>();
|
List<String> enumInputFiles = new ArrayList<>();
|
||||||
CHeaderConsumer.withC_Defines = true;
|
CHeaderConsumer.withC_Defines = true;
|
||||||
File[] boardYamlFiles = null;
|
File[] boardYamlFiles = null;
|
||||||
|
String tsOutputsDestination = null;
|
||||||
|
String definitionInputFile = null;
|
||||||
|
|
||||||
// used to update other files
|
// used to update other files
|
||||||
List<String> inputFiles = new ArrayList<>();
|
List<String> inputFiles = new ArrayList<>();
|
||||||
|
@ -109,10 +108,10 @@ public class ConfigDefinition {
|
||||||
tsInputFileFolder = args[i + 1];
|
tsInputFileFolder = args[i + 1];
|
||||||
break;
|
break;
|
||||||
case "-ts_outputs_section":
|
case "-ts_outputs_section":
|
||||||
TS_OUTPUTS_DESTINATION = args[i + 1];
|
tsOutputsDestination = args[i + 1];
|
||||||
break;
|
break;
|
||||||
case KEY_C_DESTINATION:
|
case KEY_C_DESTINATION:
|
||||||
destCHeaderFileName = args[i + 1];
|
destinations.add(new CHeaderConsumer(state.variableRegistry, args[i + 1]));
|
||||||
break;
|
break;
|
||||||
case KEY_ZERO_INIT:
|
case KEY_ZERO_INIT:
|
||||||
needZeroInit = Boolean.parseBoolean(args[i + 1]);
|
needZeroInit = Boolean.parseBoolean(args[i + 1]);
|
||||||
|
@ -246,10 +245,10 @@ public class ConfigDefinition {
|
||||||
|
|
||||||
BufferedReader definitionReader = new BufferedReader(new InputStreamReader(new FileInputStream(definitionInputFile), IoUtils.CHARSET.name()));
|
BufferedReader definitionReader = new BufferedReader(new InputStreamReader(new FileInputStream(definitionInputFile), IoUtils.CHARSET.name()));
|
||||||
|
|
||||||
if (TS_OUTPUTS_DESTINATION != null) {
|
if (tsOutputsDestination != null) {
|
||||||
destinations.add(new OutputsSectionConsumer(TS_OUTPUTS_DESTINATION + File.separator + "generated/output_channels.ini", state));
|
destinations.add(new OutputsSectionConsumer(tsOutputsDestination + File.separator + "generated/output_channels.ini", state));
|
||||||
destinations.add(new DataLogConsumer(TS_OUTPUTS_DESTINATION + File.separator + "generated/data_logs.ini"));
|
destinations.add(new DataLogConsumer(tsOutputsDestination + File.separator + "generated/data_logs.ini"));
|
||||||
destinations.add(new GaugeConsumer(TS_OUTPUTS_DESTINATION + File.separator + "generated/gauges.ini", state));
|
destinations.add(new GaugeConsumer(tsOutputsDestination + File.separator + "generated/gauges.ini", state));
|
||||||
}
|
}
|
||||||
if (tsInputFileFolder != null) {
|
if (tsInputFileFolder != null) {
|
||||||
CharArrayWriter tsWriter = new CharArrayWriter();
|
CharArrayWriter tsWriter = new CharArrayWriter();
|
||||||
|
@ -262,9 +261,6 @@ public class ConfigDefinition {
|
||||||
destinations.add(new SignatureConsumer(signatureDestination, tmpRegistry));
|
destinations.add(new SignatureConsumer(signatureDestination, tmpRegistry));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (destCHeaderFileName != null) {
|
|
||||||
destinations.add(new CHeaderConsumer(state.variableRegistry, destCHeaderFileName));
|
|
||||||
}
|
|
||||||
if (javaDestinationFileName != null) {
|
if (javaDestinationFileName != null) {
|
||||||
destinations.add(new FileJavaFieldsConsumer(state, javaDestinationFileName));
|
destinations.add(new FileJavaFieldsConsumer(state, javaDestinationFileName));
|
||||||
}
|
}
|
||||||
|
@ -278,7 +274,7 @@ public class ConfigDefinition {
|
||||||
state.readBufferedReader(definitionReader, destinations);
|
state.readBufferedReader(definitionReader, destinations);
|
||||||
|
|
||||||
if (destCDefinesFileName != null) {
|
if (destCDefinesFileName != null) {
|
||||||
ExtraUtil.writeDefinesToFile(state.variableRegistry, destCDefinesFileName);
|
ExtraUtil.writeDefinesToFile(state.variableRegistry, destCDefinesFileName, definitionInputFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (romRaiderDestination != null && romRaiderInputFile != null) {
|
if (romRaiderDestination != null && romRaiderInputFile != null) {
|
||||||
|
|
|
@ -40,12 +40,12 @@ public class ExtraUtil {
|
||||||
fw.close();
|
fw.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void writeDefinesToFile(VariableRegistry variableRegistry, String fileName) throws IOException {
|
public static void writeDefinesToFile(VariableRegistry variableRegistry, String fileName, String headerComment) throws IOException {
|
||||||
|
|
||||||
SystemOut.println("Writing to " + fileName);
|
SystemOut.println("Writing to " + fileName);
|
||||||
LazyFile cHeader = new LazyFile(fileName);
|
LazyFile cHeader = new LazyFile(fileName);
|
||||||
|
|
||||||
cHeader.write("//\n// " + ToolUtil.getGeneratedAutomaticallyTag() + ConfigDefinition.definitionInputFile + "\n//\n\n");
|
cHeader.write("//\n// " + ToolUtil.getGeneratedAutomaticallyTag() + headerComment + "\n//\n\n");
|
||||||
cHeader.write(variableRegistry.getDefinesSection());
|
cHeader.write(variableRegistry.getDefinesSection());
|
||||||
cHeader.close();
|
cHeader.close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,6 @@ public class SignatureConsumer extends AbstractConfigurationConsumer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleEndStruct(ReaderState readerState, ConfigStructure structure) throws IOException {
|
public void handleEndStruct(ReaderState readerState, ConfigStructure structure) throws IOException {
|
||||||
ExtraUtil.writeDefinesToFile(registry, destHeader);
|
ExtraUtil.writeDefinesToFile(registry, destHeader, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
package com.rusefi.test.integration;
|
|
||||||
|
|
||||||
import com.rusefi.ConfigDefinition;
|
|
||||||
import org.junit.Ignore;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
|
|
||||||
//todo: un-ignore once Ant run works which is probably messed up about missing resources
|
|
||||||
@Ignore
|
|
||||||
public class IntegrationTest {
|
|
||||||
@Test
|
|
||||||
public void largeTest() throws IOException {
|
|
||||||
|
|
||||||
String[] parameters = new String[]{
|
|
||||||
ConfigDefinition.KEY_DEFINITION,
|
|
||||||
getClass().getResource("define.txt").getFile(),
|
|
||||||
ConfigDefinition.KEY_TS_DESTINATION,
|
|
||||||
getClass().getResource(".").getFile(),
|
|
||||||
ConfigDefinition.KEY_PREPEND,
|
|
||||||
getClass().getResource("prepend.txt").getFile()
|
|
||||||
};
|
|
||||||
|
|
||||||
ConfigDefinition.main(parameters);
|
|
||||||
|
|
||||||
// todo: actually read and validate output
|
|
||||||
// todo: continues integration for this whole module
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,2 +0,0 @@
|
||||||
#define ts_show_hip9011 true
|
|
||||||
#define ts_show_etb true
|
|
|
@ -1 +0,0 @@
|
||||||
this file would be overwritten by integration test
|
|
|
@ -1 +0,0 @@
|
||||||
#define ts_show_hip9011 false
|
|
|
@ -1,3 +0,0 @@
|
||||||
|
|
||||||
subMenu = hipFunction @@if_ts_show_hip9011
|
|
||||||
subMenu = etb @@if_ts_show_etb
|
|
Loading…
Reference in New Issue