Пример #1
0
func TestLoadTools(t *testing.T) {
	DownloadCoresAndToolsAndLibraries(t)

	context := make(map[string]interface{})
	context[constants.CTX_TOOLS_FOLDERS] = []string{"downloaded_tools", "tools_builtin"}

	loader := builder.ToolsLoader{}
	err := loader.Run(context)
	NoError(t, err)

	tools := context[constants.CTX_TOOLS].([]*types.Tool)
	require.Equal(t, 7, len(tools))

	sort.Sort(ByToolIDAndVersion(tools))

	require.Equal(t, "arm-none-eabi-gcc", tools[0].Name)
	require.Equal(t, "4.8.3-2014q1", tools[0].Version)
	require.Equal(t, Abs(t, "./downloaded_tools/arm-none-eabi-gcc/4.8.3-2014q1"), tools[0].Folder)
	require.Equal(t, "avr-gcc", tools[1].Name)
	require.Equal(t, "4.8.1-arduino5", tools[1].Version)
	require.Equal(t, Abs(t, "./downloaded_tools/avr-gcc/4.8.1-arduino5"), tools[1].Folder)
	require.Equal(t, "avrdude", tools[2].Name)
	require.Equal(t, "6.0.1-arduino5", tools[2].Version)
	require.Equal(t, Abs(t, "./downloaded_tools/avrdude/6.0.1-arduino5"), tools[2].Folder)
	require.Equal(t, "bossac", tools[3].Name)
	require.Equal(t, "1.3a-arduino", tools[3].Version)
	require.Equal(t, Abs(t, "./downloaded_tools/bossac/1.3a-arduino"), tools[3].Folder)
	require.Equal(t, "bossac", tools[4].Name)
	require.Equal(t, "1.5-arduino", tools[4].Version)
	require.Equal(t, Abs(t, "./downloaded_tools/bossac/1.5-arduino"), tools[4].Folder)
}
Пример #2
0
func TestLoadToolsWithBoardManagerFolderStructure(t *testing.T) {
	DownloadCoresAndToolsAndLibraries(t)

	ctx := &types.Context{
		ToolsFolders: []string{"downloaded_board_manager_stuff"},
	}

	loader := builder.ToolsLoader{}
	err := loader.Run(ctx)
	NoError(t, err)

	tools := ctx.Tools
	require.Equal(t, 3, len(tools))

	sort.Sort(ByToolIDAndVersion(tools))

	idx := 0
	require.Equal(t, "CMSIS", tools[idx].Name)
	require.Equal(t, "4.0.0-atmel", tools[idx].Version)
	require.Equal(t, Abs(t, "./downloaded_board_manager_stuff/arduino/tools/CMSIS/4.0.0-atmel"), tools[idx].Folder)
	idx++
	require.Equal(t, "arm-none-eabi-gcc", tools[idx].Name)
	require.Equal(t, "4.8.3-2014q1", tools[idx].Version)
	require.Equal(t, Abs(t, "./downloaded_board_manager_stuff/RFduino/tools/arm-none-eabi-gcc/4.8.3-2014q1"), tools[idx].Folder)
	idx++
	require.Equal(t, "openocd", tools[idx].Name)
	require.Equal(t, "0.9.0-arduino", tools[idx].Version)
	require.Equal(t, Abs(t, "./downloaded_board_manager_stuff/arduino/tools/openocd/0.9.0-arduino"), tools[idx].Folder)
}
Пример #3
0
func TestLoadLotsOfTools(t *testing.T) {
	DownloadCoresAndToolsAndLibraries(t)

	ctx := &types.Context{
		ToolsFolders: []string{"downloaded_tools", "tools_builtin", "downloaded_board_manager_stuff"},
	}

	loader := builder.ToolsLoader{}
	err := loader.Run(ctx)
	NoError(t, err)

	tools := ctx.Tools
	require.Equal(t, 8, len(tools))

	sort.Sort(ByToolIDAndVersion(tools))

	idx := 0
	require.Equal(t, "CMSIS", tools[idx].Name)
	require.Equal(t, "4.0.0-atmel", tools[idx].Version)
	require.Equal(t, Abs(t, "./downloaded_board_manager_stuff/arduino/tools/CMSIS/4.0.0-atmel"), tools[idx].Folder)
	idx++
	require.Equal(t, "arm-none-eabi-gcc", tools[idx].Name)
	require.Equal(t, "4.8.3-2014q1", tools[idx].Version)
	require.Equal(t, Abs(t, "./downloaded_tools/arm-none-eabi-gcc/4.8.3-2014q1"), tools[idx].Folder)
	idx++
	require.Equal(t, "avr-gcc", tools[idx].Name)
	require.Equal(t, "4.8.1-arduino5", tools[idx].Version)
	require.Equal(t, Abs(t, "./downloaded_tools/avr-gcc/4.8.1-arduino5"), tools[idx].Folder)
	idx++
	require.Equal(t, "avrdude", tools[idx].Name)
	require.Equal(t, "6.0.1-arduino5", tools[idx].Version)
	require.Equal(t, Abs(t, "./downloaded_tools/avrdude/6.0.1-arduino5"), tools[idx].Folder)
	idx++
	require.Equal(t, "bossac", tools[idx].Name)
	require.Equal(t, "1.5-arduino", tools[idx].Version)
	require.Equal(t, Abs(t, "./downloaded_tools/bossac/1.5-arduino"), tools[idx].Folder)
	idx++
	require.Equal(t, "bossac", tools[idx].Name)
	require.Equal(t, "1.6.1-arduino", tools[idx].Version)
	require.Equal(t, Abs(t, "./downloaded_tools/bossac/1.6.1-arduino"), tools[idx].Folder)
	idx++
	require.Equal(t, "ctags", tools[idx].Name)
	require.Equal(t, "5.8-arduino11", tools[idx].Version)
	require.Equal(t, Abs(t, "./downloaded_tools/ctags/5.8-arduino11"), tools[idx].Folder)
	idx++
	require.Equal(t, "openocd", tools[idx].Name)
	require.Equal(t, "0.9.0-arduino", tools[idx].Version)
	require.Equal(t, Abs(t, "./downloaded_board_manager_stuff/arduino/tools/openocd/0.9.0-arduino"), tools[idx].Folder)
}
Пример #4
0
func TestLoadLotsOfTools(t *testing.T) {
	DownloadCoresAndToolsAndLibraries(t)

	context := make(map[string]interface{})
	context[constants.CTX_TOOLS_FOLDERS] = []string{"downloaded_tools", "tools_builtin", "downloaded_board_manager_stuff"}

	loader := builder.ToolsLoader{}
	err := loader.Run(context)
	NoError(t, err)

	tools := context[constants.CTX_TOOLS].([]*types.Tool)
	require.Equal(t, 8, len(tools))

	require.Equal(t, "arm-none-eabi-gcc", tools[0].Name)
	require.Equal(t, "4.8.3-2014q1", tools[0].Version)

	require.Equal(t, "openocd", tools[7].Name)
	require.Equal(t, "0.9.0-arduino", tools[7].Version)
	require.Equal(t, Abs(t, "./downloaded_board_manager_stuff/arduino/tools/openocd/0.9.0-arduino"), tools[7].Folder)
}
func TestLoadLotsOfTools(t *testing.T) {
	DownloadCoresAndToolsAndLibraries(t)

	ctx := &types.Context{
		ToolsFolders: []string{"downloaded_tools", "tools_builtin", "downloaded_board_manager_stuff"},
	}

	loader := builder.ToolsLoader{}
	err := loader.Run(ctx)
	NoError(t, err)

	tools := ctx.Tools
	require.Equal(t, 9, len(tools))

	require.Equal(t, "arm-none-eabi-gcc", tools[0].Name)
	require.Equal(t, "4.8.3-2014q1", tools[0].Version)

	require.Equal(t, "CMSIS", tools[7].Name)
	require.Equal(t, "openocd", tools[8].Name)
	require.Equal(t, "0.9.0-arduino", tools[8].Version)
	require.Equal(t, Abs(t, "./downloaded_board_manager_stuff/arduino/tools/openocd/0.9.0-arduino"), tools[8].Folder)
}
Пример #6
0
func TestLoadToolsWithBoardManagerFolderStructure(t *testing.T) {
	DownloadCoresAndToolsAndLibraries(t)

	context := make(map[string]interface{})
	context[constants.CTX_TOOLS_FOLDERS] = []string{"downloaded_board_manager_stuff"}

	loader := builder.ToolsLoader{}
	err := loader.Run(context)
	NoError(t, err)

	tools := context[constants.CTX_TOOLS].([]*types.Tool)
	require.Equal(t, 2, len(tools))

	sort.Sort(ByToolIDAndVersion(tools))

	require.Equal(t, "arm-none-eabi-gcc", tools[0].Name)
	require.Equal(t, "4.8.3-2014q1", tools[0].Version)
	require.Equal(t, Abs(t, "./downloaded_board_manager_stuff/RFduino/tools/arm-none-eabi-gcc/4.8.3-2014q1"), tools[0].Folder)

	require.Equal(t, "openocd", tools[1].Name)
	require.Equal(t, "0.9.0-arduino", tools[1].Version)
	require.Equal(t, Abs(t, "./downloaded_board_manager_stuff/arduino/tools/openocd/0.9.0-arduino"), tools[1].Folder)
}
func TestLoadTools(t *testing.T) {
	DownloadCoresAndToolsAndLibraries(t)

	ctx := &types.Context{
		ToolsFolders: []string{"downloaded_tools", "tools_builtin"},
	}

	loader := builder.ToolsLoader{}
	err := loader.Run(ctx)
	NoError(t, err)

	tools := ctx.Tools
	require.Equal(t, 7, len(tools))

	sort.Sort(ByToolIDAndVersion(tools))

	idx := 0
	require.Equal(t, "arm-none-eabi-gcc", tools[idx].Name)
	require.Equal(t, "4.8.3-2014q1", tools[idx].Version)
	require.Equal(t, Abs(t, "./downloaded_tools/arm-none-eabi-gcc/4.8.3-2014q1"), tools[idx].Folder)
	idx++
	require.Equal(t, "avr-gcc", tools[idx].Name)
	require.Equal(t, "4.8.1-arduino5", tools[idx].Version)
	require.Equal(t, Abs(t, "./downloaded_tools/avr-gcc/4.8.1-arduino5"), tools[idx].Folder)
	idx++
	require.Equal(t, "avrdude", tools[idx].Name)
	require.Equal(t, "6.0.1-arduino5", tools[idx].Version)
	require.Equal(t, Abs(t, "./downloaded_tools/avrdude/6.0.1-arduino5"), tools[idx].Folder)
	idx++
	require.Equal(t, "bossac", tools[idx].Name)
	require.Equal(t, "1.5-arduino", tools[idx].Version)
	require.Equal(t, Abs(t, "./downloaded_tools/bossac/1.5-arduino"), tools[idx].Folder)
	idx++
	require.Equal(t, "bossac", tools[idx].Name)
	require.Equal(t, "1.6.1-arduino", tools[idx].Version)
	require.Equal(t, Abs(t, "./downloaded_tools/bossac/1.6.1-arduino"), tools[idx].Folder)
}