Skip to content

Commit 81eb136

Browse files
committed
enlarge the scope of the test: verify dir tree is handled correctly
1 parent 872d230 commit 81eb136

File tree

2 files changed

+78
-11
lines changed

2 files changed

+78
-11
lines changed

tools/download_test.go

+23-11
Original file line numberDiff line numberDiff line change
@@ -96,18 +96,20 @@ func TestDownloadFallbackPlatform(t *testing.T) {
9696

9797
func TestDownload(t *testing.T) {
9898
testCases := []struct {
99-
name string
100-
version string
99+
name string
100+
version string
101+
filesCreated []string
101102
}{
102-
{"avrdude", "6.3.0-arduino17"},
103-
{"bossac", "1.6.1-arduino"},
104-
{"bossac", "1.7.0-arduino3"},
105-
{"bossac", "1.9.1-arduino2"},
106-
{"openocd", "0.11.0-arduino2"},
107-
{"dfu-util", "0.10.0-arduino1"},
108-
{"rp2040tools", "1.0.6"},
109-
{"esptool_py", "4.5.1"},
110-
{"arduino-fwuploader", "2.2.2"},
103+
{"avrdude", "6.3.0-arduino17", []string{"bin", "etc"}},
104+
{"bossac", "1.6.1-arduino", []string{"bossac"}},
105+
{"bossac", "1.7.0-arduino3", []string{"bossac"}},
106+
{"bossac", "1.9.1-arduino2", []string{"bossac"}},
107+
{"openocd", "0.11.0-arduino2", []string{"bin", "share"}},
108+
{"dfu-util", "0.10.0-arduino1", []string{"dfu-prefix", "dfu-suffix", "dfu-util"}},
109+
{"rp2040tools", "1.0.6", []string{"elf2uf2", "picotool", "pioasm", "rp2040load"}},
110+
{"esptool_py", "4.5.1", []string{"esptool", "esptool.py"}},
111+
{"arduino-fwuploader", "2.2.2", []string{"arduino-fwuploader", "LICENSE.txt"}},
112+
{"fwupdater", "0.1.12", []string{"firmwares", "FirmwareUploader", "LICENSE.txt"}}, // old legacy tool
111113
}
112114
// prepare the test environment
113115
tempDir := t.TempDir()
@@ -128,6 +130,16 @@ func TestDownload(t *testing.T) {
128130
toolDir := tempDirPath.Join("arduino-test", tc.name, tc.version)
129131
require.DirExists(t, toolDir.String())
130132

133+
// Check that the files have been created
134+
for _, file := range tc.filesCreated {
135+
filePath := toolDir.Join(file)
136+
if filePath.IsDir() {
137+
require.DirExists(t, filePath.String())
138+
} else {
139+
require.FileExists(t, filePath.String())
140+
}
141+
}
142+
131143
// Check that the tool has been installed
132144
_, ok := testTools.getMapValue(tc.name + "-" + tc.version)
133145
require.True(t, ok)

tools/testdata/test_tool_index.json

+55
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,61 @@
514514
"size": "6829396"
515515
}
516516
]
517+
},
518+
{
519+
"name": "fwupdater",
520+
"version": "0.1.12",
521+
"systems": [
522+
{
523+
"host": "i686-linux-gnu",
524+
"url": "http://downloads.arduino.cc/tools/FirmwareUploader_0.1.12_Linux_32bit.tar.bz2",
525+
"archiveFileName": "FirmwareUploader_0.1.12_Linux_32bit.tar.bz2",
526+
"checksum": "SHA-256:2fec2bdfd20ad4950bc9ba37108dc2a7c152f569174279c0697efe1f5a0db781",
527+
"size": "26097546"
528+
},
529+
{
530+
"host": "x86_64-pc-linux-gnu",
531+
"url": "http://downloads.arduino.cc/tools/FirmwareUploader_0.1.12_Linux_64bit.tar.bz2",
532+
"archiveFileName": "FirmwareUploader_0.1.12_Linux_64bit.tar.bz2",
533+
"checksum": "SHA-256:ce57d0afef30cb7d3513f5da326346c99d6bf4923bbc2200634086811f3fb31e",
534+
"size": "26073327"
535+
},
536+
{
537+
"host": "i686-mingw32",
538+
"url": "http://downloads.arduino.cc/tools/FirmwareUploader_0.1.12_Windows_32bit.zip",
539+
"archiveFileName": "FirmwareUploader_0.1.12_Windows_32bit.zip",
540+
"checksum": "SHA-256:558568b453caa1c821def8cc6d34555d0c910eb7e7e871de3ae1c39ae6f01bdd",
541+
"size": "25743641"
542+
},
543+
{
544+
"host": "x86_64-mingw32",
545+
"url": "http://downloads.arduino.cc/tools/FirmwareUploader_0.1.12_Windows_64bit.zip",
546+
"archiveFileName": "FirmwareUploader_0.1.12_Windows_64bit.zip",
547+
"checksum": "SHA-256:ec16de33620985434280c92c3c322257b89bb67adf8fd4d5dd5f9467ea1e9e40",
548+
"size": "25851428"
549+
},
550+
{
551+
"host": "i386-apple-darwin11",
552+
"url": "http://downloads.arduino.cc/tools/FirmwareUploader_0.1.12_macOS_64bit.tar.bz2",
553+
"archiveFileName": "FirmwareUploader_0.1.12_macOS_64bit.tar.bz2",
554+
"checksum": "SHA-256:a470361b57f86ddfcaecd274d844af51ee1d23a71cd6c26e30fcef2152d1a03f",
555+
"size": "25792860"
556+
},
557+
{
558+
"host": "arm-linux-gnueabihf",
559+
"url": "http://downloads.arduino.cc/tools/FirmwareUploader_0.1.12_Linux_ARM.tar.bz2",
560+
"archiveFileName": "FirmwareUploader_0.1.12_Linux_ARM.tar.bz2",
561+
"checksum": "SHA-256:855fa0a9b942c3ee18906efc510bdfe30bf3334ff28ffbb476e648ff30033847",
562+
"size": "25936245"
563+
},
564+
{
565+
"host": "aarch64-linux-gnu",
566+
"url": "http://downloads.arduino.cc/tools/FirmwareUploader_0.1.12_Linux_ARM64.tar.bz2",
567+
"archiveFileName": "FirmwareUploader_0.1.12_Linux_ARM64.tar.bz2",
568+
"checksum": "SHA-256:691461e64fe075e9a79801347c2bd895fb72f8f2c45a7cd49056c6ad9efe8fc4",
569+
"size": "25967430"
570+
}
571+
]
517572
}
518573
]
519574
}

0 commit comments

Comments
 (0)