summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/wl3501_cs.c
AgeCommit message (Expand)Author
2019-12-12netdev: pass the stuck queue to the timeout handlerMichael S. Tsirkin
2019-07-24wl3501_cs: remove redundant variable rcColin Ian King
2019-05-21treewide: Add SPDX license identifier for more missed filesThomas Gleixner
2017-07-28wl3501_cs: fix spelling mistake: "Insupported" -> "Unsupported"Colin Ian King
2016-12-24Replace <asm/uaccess.h> with <linux/uaccess.h> globallyLinus Torvalds
2016-10-13net: deprecate eth_change_mtu, remove usageJarod Wilson
2016-09-03wl3501_cs: Add spinlock to wl3501_resetPavel Andrianov
2016-06-16wl3501_cs: avoid bogus gcc-6 warningArnd Bergmann
2016-05-04treewide: replace dev->trans_start update with helperFlorian Westphal
2016-04-12cfg80211: remove enum ieee80211_bandJohannes Berg
2014-02-28wl3501_cs: replace function ieee80211_{dsss_chan_to_freq, freq_to_dsss_chan}Zhao, Gang
2014-02-24net: wireless: wl3501_cs: Remove duplicate includeSachin Kamat
2014-01-10Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linvil...John W. Linville
2014-01-03wireless: delete non-required instances of include <linux/init.h>Paul Gortmaker
2013-12-26wireless: slight optimization of addr comparedingtianhong
2013-03-15drivers/net: use module_pcmcia_driver() in pcmcia driversH Hartley Sweeten
2012-09-07wl3501_cs: use is_broadcast_ether_addr() instead of memcmp()Wei Yongjun
2012-03-28Remove all #inclusions of asm/system.hDavid Howells
2011-09-27wl3501_cs: min_t() cast truncates high bitsDan Carpenter
2011-05-06pcmcia: Convert pcmcia_device_id declarations to constJoe Perches
2011-03-31Fix common misspellingsLucas De Marchi
2010-11-01tree-wide: fix comment/printk typosUwe Kleine-König
2010-10-23Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6Linus Torvalds
2010-09-29pcmcia: remove obsolete and wrong commentsDominik Brodowski
2010-09-29pcmcia: move driver name to struct pcmcia_driverDominik Brodowski
2010-09-29pcmcia: convert pcmcia_request_configuration to pcmcia_enable_deviceDominik Brodowski
2010-09-29pcmcia: move config_{base,index,regs} to struct pcmcia_deviceDominik Brodowski
2010-09-29pcmcia: simplify IntTypeDominik Brodowski
2010-08-17ethtool: Provide a default implementation of ethtool_ops::get_drvinfoBen Hutchings
2010-08-03pcmcia: do not use io_req_t when calling pcmcia_request_io()Dominik Brodowski
2010-08-03pcmcia: do not use io_req_t after call to pcmcia_request_io()Dominik Brodowski
2010-07-30pcmcia: remove cs_types.hDominik Brodowski
2010-05-20Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6Linus Torvalds
2010-05-14drivers/net: Remove unnecessary returns from void function()sJoe Perches
2010-05-10net: trans_start cleanupsEric Dumazet
2010-05-10pcmcia: dev_node removal (drivers with unregister_netdev check)Dominik Brodowski
2010-05-10pcmcia: re-work pcmcia_request_irq()Dominik Brodowski
2010-03-23drivers/net/wireless: Use IW_HANDLER macroJoe Perches
2009-12-05Merge branch 'master' of /home/davem/src/GIT/linux-2.6/David S. Miller
2009-11-28pcmcia: rework the irq_req_t typedefDominik Brodowski
2009-11-28pcmcia: remove deprecated handle_to_dev() macroDominik Brodowski
2009-11-18wl3501_cs: remove pedantic build warningJohn W. Linville
2009-11-09pcmcia: use dynamic debug infrastructure, deprecate CS_CHECK (wireless)Dominik Brodowski
2009-09-01wireless: convert drivers to netdev_tx_tStephen Hemminger
2009-07-05net: convert remaining non-symbolic return values in ndo_start_xmit() functionsPatrick McHardy
2009-06-13net: fix network drivers ndo_start_xmit() return values (part 3)Patrick McHardy
2009-03-21wl3501: convert to net_device_opsStephen Hemminger
2009-03-21wl3501: convert to internal net_device_statsStephen Hemminger
2009-01-29wireless: Add channel/frequency conversions to ieee80211.hDavid Kilroy
2008-11-03drivers/net: Kill now superfluous ->last_rx stores.David S. Miller
' href='#n138'>138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322
// Copyright 2019 The Hugo Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package hugolib

import (
	"fmt"
	"strings"
	"testing"

	qt "github.com/frankban/quicktest"
)

// The most basic build test.
func TestHello(t *testing.T) {
	t.Parallel()
	b := newTestSitesBuilder(t)
	b.WithConfigFile("toml", `
baseURL="https://example.org"
disableKinds = ["term", "taxonomy", "section", "page"]
`)
	b.WithContent("p1", `
---
title: Page
---

`)
	b.WithTemplates("index.html", `Site: {{ .Site.Language.Lang | upper }}`)

	b.Build(BuildCfg{})

	b.AssertFileContent("public/index.html", `Site: EN`)
}

func TestSmoke(t *testing.T) {
	t.Parallel()

	c := qt.New(t)

	const configFile = `
baseURL = "https://example.com"
title = "Simple Site"
rssLimit = 3
defaultContentLanguage = "en"
enableRobotsTXT = true

[languages]
[languages.en]
weight = 1
title = "In English"
[languages.no]
weight = 2
title = "På norsk"

[params]
hugo = "Rules!"

[outputs]
  home = ["HTML", "JSON", "CSV", "RSS"]

`

	const pageContentAndSummaryDivider = `---
title: Page with outputs
hugo: "Rocks!"
outputs: ["HTML", "JSON"]
tags: [ "hugo" ]
aliases: [ "/a/b/c" ]
---

This is summary.

<!--more--> 

This is content with some shortcodes.

Shortcode 1: {{< sc >}}.
Shortcode 2: {{< sc >}}.

`

	const pageContentWithMarkdownShortcodes = `---
title: Page with markdown shortcode
hugo: "Rocks!"
outputs: ["HTML", "JSON"]
---

This is summary.

<!--more--> 

This is content[^a].

# Header above

{{% markdown-shortcode %}}
# Header inside

Some **markdown**.[^b]

{{% /markdown-shortcode %}}

# Heder below

Some more content[^c].

Footnotes:

[^a]: Fn 1
[^b]: Fn 2
[^c]: Fn 3

`

	pageContentAutoSummary := strings.Replace(pageContentAndSummaryDivider, "<!--more-->", "", 1)

	b := newTestSitesBuilder(t).WithConfigFile("toml", configFile)
	b.WithTemplatesAdded("shortcodes/markdown-shortcode.html", `
Some **Markdown** in shortcode.

{{ .Inner }}


	
`)

	b.WithTemplatesAdded("shortcodes/markdown-shortcode.json", `
Some **Markdown** in JSON shortcode.
{{ .Inner }}

`)

	for i := 1; i <= 11; i++ {
		if i%2 == 0 {
			b.WithContent(fmt.Sprintf("blog/page%d.md", i), pageContentAndSummaryDivider)
			b.WithContent(fmt.Sprintf("blog/page%d.no.md", i), pageContentAndSummaryDivider)
		} else {
			b.WithContent(fmt.Sprintf("blog/page%d.md", i), pageContentAutoSummary)
		}
	}

	for i := 1; i <= 5; i++ {
		// Root section pages
		b.WithContent(fmt.Sprintf("root%d.md", i), pageContentAutoSummary)
	}

	// https://github.com/gohugoio/hugo/issues/4695
	b.WithContent("blog/markyshort.md", pageContentWithMarkdownShortcodes)

	// Add one bundle
	b.WithContent("blog/mybundle/index.md", pageContentAndSummaryDivider)
	b.WithContent("blog/mybundle/mydata.csv", "Bundled CSV")

	const (
		commonPageTemplate            = `|{{ .Kind }}|{{ .Title }}|{{ .Path }}|{{ .Summary }}|{{ .Content }}|RelPermalink: {{ .RelPermalink }}|WordCount: {{ .WordCount }}|Pages: {{ .Pages }}|Data Pages: Pages({{ len .Data.Pages }})|Resources: {{ len .Resources }}|Summary: {{ .Summary }}`
		commonPaginatorTemplate       = `|Paginator: {{ with .Paginator }}{{ .PageNumber }}{{ else }}NIL{{ end }}`
		commonListTemplateNoPaginator = `|{{ $pages := .Pages }}{{ if .IsHome }}{{ $pages = .Site.RegularPages }}{{ end }}{{ range $i, $e := ($pages | first 1) }}|Render {{ $i }}: {{ .Kind }}|{{ .Render "li" }}|{{ end }}|Site params: {{ $.Site.Params.hugo }}|RelPermalink: {{ .RelPermalink }}`
		commonListTemplate            = commonPaginatorTemplate + `|{{ $pages := .Pages }}{{ if .IsHome }}{{ $pages = .Site.RegularPages }}{{ end }}{{ range $i, $e := ($pages | first 1) }}|Render {{ $i }}: {{ .Kind }}|{{ .Render "li" }}|{{ end }}|Site params: {{ $.Site.Params.hugo }}|RelPermalink: {{ .RelPermalink }}`
		commonShortcodeTemplate       = `|{{ .Name }}|{{ .Ordinal }}|{{ .Page.Summary }}|{{ .Page.Content }}|WordCount: {{ .Page.WordCount }}`
		prevNextTemplate              = `|Prev: {{ with .Prev }}{{ .RelPermalink }}{{ end }}|Next: {{ with .Next }}{{ .RelPermalink }}{{ end }}`
		prevNextInSectionTemplate     = `|PrevInSection: {{ with .PrevInSection }}{{ .RelPermalink }}{{ end }}|NextInSection: {{ with .NextInSection }}{{ .RelPermalink }}{{ end }}`
		paramsTemplate                = `|Params: {{ .Params.hugo }}`
		treeNavTemplate               = `|CurrentSection: {{ .CurrentSection }}`
	)

	b.WithTemplates(
		"_default/list.html", "HTML: List"+commonPageTemplate+commonListTemplate+"|First Site: {{ .Sites.First.Title }}",
		"_default/list.json", "JSON: List"+commonPageTemplate+commonListTemplateNoPaginator,
		"_default/list.csv", "CSV: List"+commonPageTemplate+commonListTemplateNoPaginator,
		"_default/single.html", "HTML: Single"+commonPageTemplate+prevNextTemplate+prevNextInSectionTemplate+treeNavTemplate,
		"_default/single.json", "JSON: Single"+commonPageTemplate,

		// For .Render test
		"_default/li.html", `HTML: LI|{{ strings.Contains .Content "HTML: Shortcode: sc" }}`+paramsTemplate,
		"_default/li.json", `JSON: LI|{{ strings.Contains .Content "JSON: Shortcode: sc" }}`+paramsTemplate,
		"_default/li.csv", `CSV: LI|{{ strings.Contains .Content "CSV: Shortcode: sc" }}`+paramsTemplate,

		"404.html", "{{ .Kind }}|{{ .Title }}|Page not found",

		"shortcodes/sc.html", "HTML: Shortcode: "+commonShortcodeTemplate,
		"shortcodes/sc.json", "JSON: Shortcode: "+commonShortcodeTemplate,
		"shortcodes/sc.csv", "CSV: Shortcode: "+commonShortcodeTemplate,
	)

	b.CreateSites().Build(BuildCfg{})

	b.AssertFileContent("public/blog/page1/index.html",
		"This is content with some shortcodes.",
		"Page with outputs",
		"Pages: Pages(0)",
		"RelPermalink: /blog/page1/|",
		"Shortcode 1: HTML: Shortcode: |sc|0|||WordCount: 0.",
		"Shortcode 2: HTML: Shortcode: |sc|1|||WordCount: 0.",
		"Prev: /blog/page10/|Next: /blog/mybundle/",
		"PrevInSection: /blog/page10/|NextInSection: /blog/mybundle/",
		"Summary: This is summary.",
		"CurrentSection: Page(/blog)",
	)

	b.AssertFileContent("public/blog/page1/index.json",
		"JSON: Single|page|Page with outputs|",
		"SON: Shortcode: |sc|0||")

	b.AssertFileContent("public/index.html",
		"home|In English",
		"Site params: Rules",
		"Pages: Pages(6)|Data Pages: Pages(6)",
		"Paginator: 1",
		"First Site: In English",
		"RelPermalink: /",
	)

	b.AssertFileContent("public/no/index.html", "home|På norsk", "RelPermalink: /no/")

	// Check RSS
	rssHome := b.FileContent("public/index.xml")
	c.Assert(rssHome, qt.Contains, `<atom:link href="https://example.com/index.xml" rel="self" type="application/rss+xml" />`)
	c.Assert(strings.Count(rssHome, "<item>"), qt.Equals, 3) // rssLimit = 3

	// .Render should use template/content from the current output format
	// even if that output format isn't configured for that page.
	b.AssertFileContent(
		"public/index.json",
		"Render 0: page|JSON: LI|false|Params: Rocks!",
	)

	b.AssertFileContent(
		"public/index.html",
		"Render 0: page|HTML: LI|false|Params: Rocks!|",
	)

	b.AssertFileContent(
		"public/index.csv",
		"Render 0: page|CSV: LI|false|Params: Rocks!|",
	)

	// Check bundled resources
	b.AssertFileContent(
		"public/blog/mybundle/index.html",
		"Resources: 1",
	)

	// Check pages in root section
	b.AssertFileContent(
		"public/root3/index.html",
		"Single|page|Page with outputs|root3.md|",
		"Prev: /root4/|Next: /root2/|PrevInSection: /root4/|NextInSection: /root2/",
	)

	b.AssertFileContent(
		"public/root3/index.json", "Shortcode 1: JSON:")

	// Paginators
	b.AssertFileContent("public/page/1/index.html", `rel="canonical" href="https://example.com/"`)
	b.AssertFileContent("public/page/2/index.html", "HTML: List|home|In English|", "Paginator: 2")

	// 404
	b.AssertFileContent("public/404.html", "404|404 Page not found")

	// Sitemaps
	b.AssertFileContent("public/en/sitemap.xml", "<loc>https://example.com/blog/</loc>")
	b.AssertFileContent("public/no/sitemap.xml", `hreflang="no"`)

	b.AssertFileContent("public/sitemap.xml", "<loc>https://example.com/en/sitemap.xml</loc>", "<loc>https://example.com/no/sitemap.xml</loc>")

	// robots.txt
	b.AssertFileContent("public/robots.txt", `User-agent: *`)

	// Aliases
	b.AssertFileContent("public/a/b/c/index.html", `refresh`)

	// Markdown vs shortcodes
	// Check that all footnotes are grouped (even those from inside the shortcode)
	b.AssertFileContentRe("public/blog/markyshort/index.html", `Footnotes:.*<ol>.*Fn 1.*Fn 2.*Fn 3.*</ol>`)
}

// https://github.com/golang/go/issues/30286
func TestDataRace(t *testing.T) {
	const page = `
---
title: "The Page"
outputs: ["HTML", "JSON"]
---	

The content.
	

	`

	b := newTestSitesBuilder(t).WithSimpleConfigFile()
	for i := 1; i <= 50; i++ {
		b.WithContent(fmt.Sprintf("blog/page%d.md", i), page)
	}

	b.WithContent("_index.md", `
---
title: "The Home"
outputs: ["HTML", "JSON", "CSV", "RSS"]
---	

The content.
	

`)

	commonTemplate := `{{ .Data.Pages }}`

	b.WithTemplatesAdded("_default/single.html", "HTML Single: "+commonTemplate)
	b.WithTemplatesAdded("_default/list.html",